[issue19230] Reimplement the keyword module in C

2013-12-13 Thread Brett Cannon
Brett Cannon added the comment: You're right, the regeneration might be specific to CPython (although maybe it should work from Grammar/Grammar instead?), but that's just creating the Python file which we check into the stdlib, so any VM can use it, they just can't recreate it (which is fine s

[issue19230] Reimplement the keyword module in C

2013-12-13 Thread STINNER Victor
STINNER Victor added the comment: > Second, PEP 399 requires the pure Python version stick around, else you need > to request an exception to drop keyword.py from python-dev. I don't understand the purpose of providing a Python implementation of the keyword module. If you look at the current i

[issue19230] Reimplement the keyword module in C

2013-12-13 Thread Brett Cannon
Brett Cannon added the comment: Two things. One, no one has shown a startup improvement using the official startup benchmarks (either normal or nosite). That needs to be established to show an actual benefit. Second, PEP 399 requires the pure Python version stick around, else you need to requ

[issue19230] Reimplement the keyword module in C

2013-12-13 Thread Christian Heimes
Christian Heimes added the comment: I still like the idea, too. It's more elegant, easier to maintain and gives a speedup, too. -- ___ Python tracker ___ ___

[issue19230] Reimplement the keyword module in C

2013-12-12 Thread STINNER Victor
STINNER Victor added the comment: So what? Do you want faster Python startup? -- ___ Python tracker ___ ___ Python-bugs-list mailing l

[issue19230] Reimplement the keyword module in C

2013-10-31 Thread STINNER Victor
STINNER Victor added the comment: "IMO this should be rejected. Failure to improve startup time + more complicated maintenance." What do you mean by "complicated maintenance"? The C module is short and doesn't use complex functions, I don't expect it to change. -- ___

[issue19230] Reimplement the keyword module in C

2013-10-31 Thread STINNER Victor
STINNER Victor added the comment: Original: $ ./python -S -m timeit -s 'import sys' 'import keyword; keyword=None; del sys.modules["keyword"]' 1 loops, best of 3: 149 usec per loop Python patched with keyword_grammar.patch: $ ./python -S -m timeit -s 'import sys' 'import keyword; keyword

[issue19230] Reimplement the keyword module in C

2013-10-12 Thread Brett Cannon
Brett Cannon added the comment: Is there any change in any benchmark? -- nosy: +brett.cannon ___ Python tracker ___ ___ Python-bugs-li

[issue19230] Reimplement the keyword module in C

2013-10-12 Thread STINNER Victor
STINNER Victor added the comment: > If it needs to be automated it can be added to the Makefile... I tested keyword_grammar.patch on a fresh Python source code (make distclean; ./configure --with-pydebug; make): I can compile Python. I don't understand what should be automated? This patch does

[issue19230] Reimplement the keyword module in C

2013-10-12 Thread Antoine Pitrou
Antoine Pitrou added the comment: > Well, combined with the fact that it gets rid of a manual regeneration step > (that is easy to forget, since adding a keyword is not done very often) I > think it's a net gain. If it needs to be automated it can be added to the Makefile... -- _

[issue19230] Reimplement the keyword module in C

2013-10-12 Thread Georg Brandl
Georg Brandl added the comment: Well, combined with the fact that it gets rid of a manual regeneration step (that is easy to forget, since adding a keyword is not done very often) I think it's a net gain. The same could be done with the "token" module BTW. -- nosy: +georg.brandl

[issue19230] Reimplement the keyword module in C

2013-10-12 Thread Antoine Pitrou
Antoine Pitrou added the comment: -1 again. We shouldn't gratuitously convert Python code to C code. -- ___ Python tracker ___ ___ Pyt

[issue19230] Reimplement the keyword module in C

2013-10-12 Thread Christian Heimes
Christian Heimes added the comment: Here is a simpler patch that directly uses the grammar definition to create a list of keywords. It completely removes the necessity of a script. -- components: +Extension Modules stage: -> patch review Added file: http://bugs.python.org/file32058/key

[issue19230] Reimplement the keyword module in C

2013-10-12 Thread Antoine Pitrou
Antoine Pitrou added the comment: IMO this should be rejected. Failure to improve startup time + more complicated maintenance. -- ___ Python tracker ___

[issue19230] Reimplement the keyword module in C

2013-10-11 Thread STINNER Victor
STINNER Victor added the comment: The patch adds 448 bytes to the stripped python executable file. -- ___ Python tracker ___ ___ Pytho

[issue19230] Reimplement the keyword module in C

2013-10-11 Thread STINNER Victor
STINNER Victor added the comment: I fail to see a difference with my patch in the startup time, but I see that the number of syscalls is reduced by 10 (558 => 548). -- ___ Python tracker __

[issue19230] Reimplement the keyword module in C

2013-10-11 Thread STINNER Victor
New submission from STINNER Victor: To speedup Python startup, I propose to reimplement the keyword module in C. Attached patch implements it. * Remove Lib/keyword.py * Add Tools/scripts/keyword.py: script to build Modules/keyword.h * The new module is Modules/keyword.c I chose to change the k