This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author neologix
Recipients Arfrever, barry, eric.smith, eric.snow, georg.brandl, giampaolo.rodola, loewis, nadeem.vawda, neologix, pitrou, python-dev, rhettinger, terry.reedy, vstinner
Date 2012-02-18.12:22:57
SpamBayes Score 9.883798e-07
Marked as misclassified No
Message-id <1329567778.63.0.141318553169.issue11051@psf.upfronthosting.co.za>
In-reply-to
Content
As noted by Antoine somewhere else (don't remember if it was on the bug tracker or mailing list), most of the startup time is due to site import:

"""
cf@neobox:~/python/cpython$ time ./python -c ''
[44249 refs]

real    0m0.445s
user    0m0.376s
sys     0m0.032s
cf@neobox:~/python/cpython$ time ./python -S -c ''
[35211 refs]

real    0m0.181s
user    0m0.144s
sys     0m0.016s
"""

And that's mostly user time, the stat() calls don't weight much here.

Here's the output of a profiling:
"""

   Ordered by: cumulative time

   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
      2/1    0.006    0.003    0.303    0.303 {built-in method exec}
        1    0.004    0.004    0.303    0.303 test_startup.py:1(<module>)
        1    0.000    0.000    0.267    0.267 site.py:509(main)
        1    0.000    0.000    0.237    0.237 site.py:254(addusersitepackages)
        1    0.000    0.000    0.236    0.236 site.py:231(getusersitepackages)
        1    0.006    0.006    0.226    0.226 site.py:217(getuserbase)
        1    0.011    0.011    0.214    0.214 sysconfig.py:1(<module>)
        1    0.004    0.004    0.122    0.122 configparser.py:120(<module>)
       30    0.006    0.000    0.120    0.004 {built-in method __build_class__}
        9    0.000    0.000    0.116    0.013 re.py:204(compile)
        9    0.002    0.000    0.116    0.013 functools.py:185(wrapper)
        9    0.000    0.000    0.113    0.013 re.py:256(_compile)
        9    0.001    0.000    0.113    0.013 sre_compile.py:488(compile)
        1    0.001    0.001    0.096    0.096 configparser.py:555(RawConfigParser)
"""

On my (somewhat old) laptop, sysconfig import consumes 1/3 of the 
total startup time.
History
Date User Action Args
2012-02-18 12:22:58neologixsetrecipients: + neologix, loewis, barry, georg.brandl, rhettinger, terry.reedy, pitrou, vstinner, eric.smith, giampaolo.rodola, nadeem.vawda, Arfrever, python-dev, eric.snow
2012-02-18 12:22:58neologixsetmessageid: <1329567778.63.0.141318553169.issue11051@psf.upfronthosting.co.za>
2012-02-18 12:22:58neologixlinkissue11051 messages
2012-02-18 12:22:57neologixcreate