[Python-Dev] Startup time (original) (raw)
Guido van Rossum guido@python.org
Tue, 06 May 2003 08:07:54 -0400
- Previous message: [Python-Dev] Windows installer request...
- Next message: [Python-Dev] Startup time
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
While Python's general speed has gone up, its startup speed has slowed down!
I timed this two different ways. The first way is to run
python -c "import time; print time.clock()"
On Unix, this prints the CPU time used since the process was created. The second way is to run
time python -c pass
which shows CPU and real time to complete running the process. I did this on a 633 MHz PC running Red Hat Linux 7.3. The Python builds were standard non-debug builds. I tried with and without the -S option, which is supposed to suppress loading of site.py and hence most startup overhead; it didn't exist in Python 1.3 and 1.4.
Results for the first way are pretty inaccurate because it's such a small number and is only measured in 1/100 of a second, yet revealing. Some times are printed as two values; I didn't do enough runs to compute a careful average, so I'm just showing the range:
Version CPU Time CPU Time with -S 1.3 0.00 N/A 1.4 0.00 N/A 1.5.2 0.01 0.00 2.0 0.01-0.02 0.00 2.1 0.01-0.02 0.00 2.2 0.02 0.00 2.3 0.04 0.03-0.04
Now using time:
Version CPU Time CPU Time with -S 1.3 0.004 N/A 1.4 0.004 N/A 1.5 0.018 0.006 2.0 0.021 0.006 2.1 0.018 0.004 2.2 0.025 0.004 2.3 0.045 0.045
Note two things: (a) the start time goes up over time, and (b) for Python 2.3, -S doesn't make any difference.
Given that we often run very short Python programs, and e.g. Python's popularity for CGI scripts, I find this increase in startup time very worrysome, and worthy of our attention (more than gaining nanoseconds on dict operations or even socket I/O speed).
My goal: I'd like Python 2.3(final) to start up at least as fast as Python 2.2, and I'd like the much faster startup time back with -S.
I have no time to investigate the cause right now, although I have a suspicion that the problem might be in loading too much of the encoding framework at start time (I recall Marc-Andre and Martin debating this earlier).
--Guido van Rossum (home page: http://www.python.org/~guido/)
- Previous message: [Python-Dev] Windows installer request...
- Next message: [Python-Dev] Startup time
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]