[Python-Dev] Patch to speed up python 2.4 startup time

Nick Bastin nbastin at opnet.com
Wed Mar 24 22:36:06 EST 2004


I've put a patch up at sourceforge (#922881) which is somewhat hackish 
change in warnings.py that gets back about 50% of the startup time we 
lost between 2.2.2 and 2.3.x, while avoiding the import deadlock 
problem with delayed import.  The general feeling that I get from the 
developers that I've surveyed is that it sounds/looks good, but I 
wanted some more people to take a look at it.  I'm also working on a 
plan for solving the import deadlock problem in the long term 
(per-module locking - more on that later).

This patch does pass all tests.

The timings are below:

PYTHON STARTUP TIME - 100 INVOCATIONS (no site.py)

-------------------------------------
Python 2.2.2 release tree, 9:06, 4/24/2004
-------------------------------------
3.450u 2.200s 0:05.96 94.7%     0+0k 0+0io 0pf+0w
3.410u 2.270s 0:05.96 95.3%     0+0k 0+0io 0pf+0w
3.400u 2.340s 0:05.92 96.9%     0+0k 0+0io 0pf+0w
-------------------------------------------------
3.420u 2.270s 0:05.95
-------------------------------------------------

-------------------------------------
Current 2.4 tree, 21:30, 04/23/2004
-------------------------------------
5.410u 4.310s 0:10.50 92.5%     0+0k 0+0io 0pf+0w
5.680u 4.270s 0:10.49 94.8%     0+0k 0+0io 0pf+0w
5.720u 4.330s 0:10.52 95.5%     0+0k 0+0io 0pf+0w
-------------------------------------------------
5.603u 4.303s 0:10.50
-------------------------------------------------

-------------------------------------
Current 2.4 with warnings.py patch
-------------------------------------
4.380u 3.450s 0:08.23 95.1%     0+0k 0+0io 0pf+0w
4.420u 3.410s 0:08.31 94.2%     0+0k 0+0io 0pf+0w
4.580u 3.190s 0:08.24 94.2%     0+0k 0+0io 0pf+0w
-------------------------------------------------
4.460u 3.350s 0:08.26
-------------------------------------------------

--
Nick




More information about the Python-Dev mailing list