[issue11051] system calls per import
Charles-François Natali
report at bugs.python.org
Sat Feb 18 13:22:58 CET 2012
Charles-François Natali <neologix at free.fr> added the comment:
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 at neobox:~/python/cpython$ time ./python -c ''
[44249 refs]
real 0m0.445s
user 0m0.376s
sys 0m0.032s
cf at 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.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue11051>
_______________________________________
More information about the Python-bugs-list
mailing list