Path: csiph.com!usenet.pasdenom.info!news.redatomik.org!newsfeed.xs4all.nl!newsfeed3a.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'subject:text': 0.05; 'assign': 0.07; 'debug': 0.07; 'defaults': 0.07; 'memory.': 0.07; 'needed,': 0.07; 'puts': 0.07; 'suppose': 0.07; 'x86': 0.07; "(i'd": 0.09; 'assigning': 0.09; 'closest': 0.09; 'debugging.': 0.09; 'function,': 0.09; 'happen,': 0.09; 'linear': 0.09; 'linker': 0.09; 'may,': 0.09; 'mem': 0.09; 'portions': 0.09; 'positioned': 0.09; 'subject:question': 0.10; 'project,': 0.12; 'sections': 0.14; 'times,': 0.14; 'changes': 0.15; 'windows': 0.15; '(actually': 0.16; 'absolute,': 0.16; 'adjacent': 0.16; 'adjusted': 0.16; 'boundary,': 0.16; 'deferred': 0.16; "dll's": 0.16; 'dll,': 0.16; 'handlers': 0.16; 'here).': 0.16; 'libre': 0.16; 'mapped': 0.16; 'once.': 0.16; 'presume': 0.16; 'programmer,': 0.16; 'rarely': 0.16; 'read-write': 0.16; 'unlikely': 0.16; 'usage,': 0.16; 'variables,': 0.16; 'exception': 0.16; 'relocation': 0.16; 'sat,': 0.16; 'wrote:': 0.18; 'code.': 0.18; 'obviously': 0.18; 'trying': 0.19; 'file,': 0.19; 'examples': 0.20; 'fit': 0.20; 'feb': 0.22; 'memory': 0.22; '(in': 0.22; 'handles': 0.22; 'preferred': 0.22; 'load': 0.23; 'header :User-Agent:1': 0.23; 'copied': 0.24; 'dll': 0.24; 'merge': 0.24; 'space.': 0.24; 'together.': 0.24; 'file.': 0.24; "haven't": 0.24; 'question': 0.24; 'references': 0.26; 'tables': 0.26; 'least': 0.26; 'gets': 0.27; 'header:In-Reply-To:1': 0.27; 'point': 0.28; 'chris': 0.29; 'on,': 0.29; 'am,': 0.29; 'dos': 0.30; 'locations': 0.30; 'mode': 0.30; "i'm": 0.30; 'code': 0.31; 'about.': 0.31; 'loading': 0.31; 'location,': 0.31; 'know.': 0.32; 'run': 0.32; 'linux': 0.33; 'worked': 0.33; 'running': 0.33; 'not.': 0.33; 'older': 0.33; 'updated': 0.34; 'could': 0.34; 'problem': 0.35; "can't": 0.35; 'case,': 0.35; 'but': 0.35; 'there': 0.35; 'addresses,': 0.36; 'disk': 0.36; 'largely': 0.36; 'done': 0.36; "didn't": 0.36; 'possible': 0.36; 'should': 0.36; 'virtual': 0.37; 'application': 0.37; 'performance': 0.37; 'step': 0.37; 'sometimes': 0.38; 'bringing': 0.38; 'mapping': 0.38; 'others.': 0.38; 'saves': 0.38; 'needed': 0.38; 'to:addr:python-list': 0.38; 'rather': 0.38; 'though,': 0.39; 'to:addr:python.org': 0.39; 'reserved': 0.61; 'full': 0.61; "you're": 0.61; 'further': 0.61; 'first': 0.61; 'back': 0.62; 'making': 0.63; 'address': 0.63; 'office,': 0.64; 'places': 0.64; 'more': 0.64; 'talking': 0.65; 'charset:windows-1252': 0.65; 'between': 0.67; 'frequently': 0.68; 'received:74.208': 0.68; 'physical': 0.72; 'yourself': 0.78; 'savings': 0.81; '2015': 0.84; 'complexity': 0.84; 'etc),': 0.84; 'routines': 0.84; 'demand': 0.91; 'forgotten': 0.91; 'instant': 0.97 Date: Fri, 27 Feb 2015 15:52:24 -0500 From: Dave Angel User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: python-list@python.org Subject: Re: Newbie question about text encoding References: <201502241620.t1OGKf4n002146@fido.openend.se> <54ECB134.5090304@davea.name> <201502241945.t1OJjshO013092@fido.openend.se> <201502241957.t1OJvrJS015604@fido.openend.se> <00fbd940-52f6-44e2-bf08-b9f35c12e73f@googlegroups.com> <54efc2c8$0$12986$c3e8da3$5496439d@news.astraweb.com> <54f00787$0$12979$c3e8da3$5496439d@news.astraweb.com> <54f05aff$0$12980$c3e8da3$5496439d@news.astraweb.com> <54F078FD.5030801@davea.name> In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Provags-ID: V02:K0:5bj32Ip3AdQMfEN23H331X+BTmgaAX+zqvmaCGKHb5j M6EzXq9lu1iYg/L/Nrrz78ui+HaeD5B/hh7/SIQk2ghJq0oAlp CkFouwsTLSRPvuYto2BjvHOpmWvQuvTeHQ2cZa4bMI0Lj4SVLg HQYog/iTs2vMzbAYxOGRnELKVMMLJDHZegtRIkpuefNawq6dTn F+hXIqG4ohylAiIqXUxVtX19cz4zzgTAAIXCnS1cVTO32+UUYD Me6NSyYDIuB9bGwgKKDTX7hSQkwCnwAA9q5gq3W5HJMQJuW9lF /uTv7DpvMqnwR45YCMSAKYsx0d2dxcAWx2P/1nAfATdkiufLbY LuQwJDuyPQwySmqiQaMU= X-UI-Out-Filterresults: notjunk:1; X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 80 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1425070352 news.xs4all.nl 2852 [2001:888:2000:d::a6]:45257 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:86590 On 02/27/2015 11:00 AM, alister wrote: > On Sat, 28 Feb 2015 01:22:15 +1100, Chris Angelico wrote: > >> >> If you're trying to use the pagefile/swapfile as if it's more memory ("I >> have 256MB of memory, but 10GB of swap space, so that's 10GB of >> memory!"), then yes, these performance considerations are huge. But >> suppose you need to run a program that's larger than your available RAM. >> On MS-DOS, sometimes you'd need to work with program overlays (a concept >> borrowed from older systems, but ones that I never worked on, so I'm >> going back no further than DOS here). You get a *massive* complexity hit >> the instant you start using them, whether your program would have been >> able to fit into memory on some systems or not. Just making it possible >> to have only part of your code in memory places demands on your code >> that you, the programmer, have to think about. With virtual memory, >> though, you just write your code as if it's all in memory, and some of >> it may, at some times, be on disk. Less code to debug = less time spent >> debugging. The performance question is largely immaterial (you'll be >> using the disk either way), but the savings on complexity are >> tremendous. And then when you do find yourself running on a system with >> enough RAM? No code changes needed, and full performance. That's where >> virtual memory shines. >> ChrisA > > I think there is a case for bringing back the overlay file, or at least > loading larger programs in sections > only loading the routines as they are required could speed up the start > time of many large applications. > examples libre office, I rarely need the mail merge function, the word > count and may other features that could be added into the running > application on demand rather than all at once. > > obviously with large memory & virtual mem there is no need to un-install > them once loaded. > I can't say how Linux handles it (I'd like to know, but haven't needed to yet), but in Windows (NT, XP, etc), a DLL is not "loaded", but rather mapped. And it's not copied into the swapfile, it's mapped directly from the DLL. The mapping mode is "copy-on-write" which means that read=only portions are swapped directly from the DLL, on first usage, while read-write portions (eg. static/global variables, relocation modifications) are copied on first use to the swap file. I presume EXE's are done the same way, but never had a need to know. If that's the case on the architectures you're talking about, then the problem of slow loading is not triggered by the memory usage, but by lots of initialization code. THAT's what should be deferred for seldom-used portions of code. The main point of a working-set-tuner is to group sections of code together that are likely to be used together. To take an extreme case, all the fatal exception handlers should be positioned adjacent to each other in linear memory, as it's unlikely that any of them will be needed, and the code takes up no time or space in physical memory. Also (in Windows), a DLL can be pre-relocated, so that it has a preferred address to be loaded into memory. If that memory is available when it gets loaded (actually mapped), then no relocation needs to happen, which saves time and swap space. In the X86 architecture, most code is self-relocating, everything is relative. But references to other DLL's and jump tables were absolute, so they needed to be relocated at load time, when final locations were nailed down. Perhaps the authors of bloated applications have forgotten how to do these, as the defaults in the linker puts all DLL's in the same location, meaning all but the first will need relocating. But system DLL's are (were) each given unique addresses. On one large project, I added the build step of assigning these base addresses. Each DLL had to start on a 64k boundary, and I reserved some fractional extra space between them in case one would grow. Then every few months, we double-checked that they didn't overlap, and if necessary adjusted the start addresses. We didn't just automatically assign closest addresses, because frequently some of the DLL's would be updated independently of the others. -- DaveA