[issue19230] Reimplement the keyword module in C

STINNER Victor report at bugs.python.org
Fri Nov 1 02:19:40 CET 2013


STINNER Victor added the comment:

Original:

$ ./python -S -m timeit -s 'import sys' 'import keyword; keyword=None; del sys.modules["keyword"]'
10000 loops, best of 3: 149 usec per loop

Python patched with  keyword_grammar.patch:

$ ./python -S -m timeit -s 'import sys' 'import keyword; keyword=None; del sys.modules["keyword"]'
10000 loops, best of 3: 20 usec per loop


The gain is 129 microseconds (import 7.4x faster). Python starts in between 8,850 and 13,800 microseconds on my PC:


$ ./python -S -m timeit -s 'import subprocess; args=[sys.executable, "-S", "-c", "pass"]' 'subprocess.call(args)'
100 loops, best of 3: 8.85 msec per loop

$ ./python -S -m timeit -s 'import subprocess; args=[sys.executable, "-c", "pass"]' 'subprocess.call(args)'
100 loops, best of 3: 13.8 msec per loop

----------

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


More information about the Python-bugs-list mailing list