Newbie question about text encoding
Chris Angelico
rosuav at gmail.com
Fri Feb 27 16:04:44 EST 2015
On Sat, Feb 28, 2015 at 7:52 AM, Dave Angel <davea at davea.name> 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
More information about the Python-list
mailing list