Path: csiph.com!usenet.pasdenom.info!news.redatomik.org!newsfeed.xs4all.nl!newsfeed2.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.020 X-Spam-Evidence: '*H*': 0.96; '*S*': 0.00; 'subject:text': 0.05; 'portions': 0.09; 'subject:question': 0.10; 'cc:addr:python-list': 0.11; 'python': 0.11; '(it': 0.16; 'deferred': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'unexpected': 0.16; 'usage,': 0.16; 'prevent': 0.16; 'sat,': 0.16; 'wrote:': 0.18; 'code.': 0.18; 'module': 0.19; 'feb': 0.22; 'memory': 0.22; 'import': 0.22; 'cc:addr:python.org': 0.22; 'cc:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; 'thus': 0.29; 'message-id:@mail.gmail.com': 0.30; 'code': 0.31; 'initialized': 0.31; 'loading': 0.31; 'with,': 0.31; 'weeks': 0.32; 'ago': 0.33; 'comment': 0.34; 'problem': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'add': 0.35; 'should': 0.36; 'clear': 0.37; 'use.': 0.39; 'even': 0.60; 'dave': 0.60; "you're": 0.61; 'first': 0.61; 'making': 0.63; 'name': 0.63; 'talking': 0.65; 'statement,': 0.68; 'fact,': 0.69; '2015': 0.84; 'angel': 0.91; 'to:none': 0.92 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=CSsTWPJEWPvC9H+pTQkF1LX4+1izMUUpAKdLIJQnmyM=; b=CDyCom8zC37W3I6FhvnfBfo/nN/NuKa0RIOSkDYvUn16ce+jjX5CCDRo4+dXtf+ZX6 KgADzBjwLU40rA2N9J8mQhW/ZBCjA9xALqLeKeyQX7Rx5xJNkjggrO4vlY7a57R34U7W oMTystQYRlftTA7FIXl84CoID/5JNrHyP+23nuxzwwlEFrROahlSvU58nQy9jXxKQAFH im4PueK3XC5tFy93kDiE0di+U+FPB4ogiqYJm1DLJkUa0zrZCcW87UsIZOU65deIM8Le Fh7IF1nCtK6pzBIB9wwciJ5GuX9F3joK8nU1+ciyZQ6iJUQZq8rVCYXJf+0QD83w71Fz a+TA== MIME-Version: 1.0 X-Received: by 10.107.128.219 with SMTP id k88mr20996316ioi.27.1425071084920; Fri, 27 Feb 2015 13:04:44 -0800 (PST) In-Reply-To: <54F0D908.3060500@davea.name> 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> <54F0D908.3060500@davea.name> Date: Sat, 28 Feb 2015 08:04:44 +1100 Subject: Re: Newbie question about text encoding From: Chris Angelico Cc: "python-list@python.org" Content-Type: text/plain; charset=UTF-8 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: 20 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1425071093 news.xs4all.nl 2977 [2001:888:2000:d::a6]:51027 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:86591 On Sat, Feb 28, 2015 at 7:52 AM, Dave Angel wrote: > 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. s/should/can/ It's still not a clear case of "should", as it's all a big pile of trade-offs. A few weeks ago I made a very deliberate change to a process to force some code to get loaded and initialized earlier, to prevent an unexpected (and thus surprising) slowdown on first use. (It was, in fact, a Python 'import' statement, so all I had to do was add a dummy import in the main module - with, of course, a comment making it clear that this was necessary, even though the name wasn't used.) But yes, seldom-used code can definitely have its initialization deferred if you need to speed up startup. ChrisA