[Python-Dev] Startup time (original) (raw)

Jeff Epler jepler@unpythonic.net
Wed, 7 May 2003 12:06:18 -0500


On Tue, May 06, 2003 at 07:35:40PM +0200, Martin v. L=F6wis wrote:

That would be easy to determine: Just disable the block =20 #if defined(PyUSINGUNICODE) && defined(HAVELANGINFOH) && defined(CO= DESET) =20 in pythonrun.c, and see whether it changes anything. To my knowledge, this is the only cause of loading encodings during startup on Unix.

With this change, I typically see real 0m0.020s user 0m0.020s sys 0m0.000s instead of real 0m0.022s user 0m0.020s sys 0m0.000s

The number of successful open()s decreases, but not by much:

before change

$ strace -e open ./python-2.3 -S -c pass 2>&1 | grep -v ENOENT | wc -l 46

after change

$ strace -e open ./python -S -c pass 2>&1 | grep -v ENOENT | wc -l 39

What about this line? It seems to be the cause of a bunch of imports, including the sre stuff: /* pythonrun.c */ PyModule_WarningsModule =3D PyImport_ImportModule("warnings");

Jeff