[issue30152] Reduce the number of imports for argparse

Serhiy Storchaka report at bugs.python.org
Fri Apr 28 02:05:21 EDT 2017


Serhiy Storchaka added the comment:

After reverting some changes (import heapq on Raymond's request and import gettext since it is needed for the ArgumentParser constructor) the effect of the patch is reducing the number of imports by 6 and the time by 0.017 sec (> 10%) on my computer.

$ time for i in `seq 100`; do ./python -S -c 'import argparse; argparse.ArgumentParser()'; done

Unpatched:
real    0m13.236s
user    0m12.100s
sys     0m0.808s

Patched:
real    0m11.535s
user    0m10.356s
sys     0m0.756s

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue30152>
_______________________________________


More information about the Python-bugs-list mailing list