[issue39150] See if PyToken_OneChar would be faster as a lookup table

Pablo Galindo Salgado report at bugs.python.org
Sun Dec 29 00:19:11 EST 2019


Pablo Galindo Salgado <pablogsal at gmail.com> added the comment:

> PyToken_OneChar in Parser/token.c is autogenerated.  I suspect it may be faster and smaller if it were a lookup into a static table of ops rather than a switch statement.  Check to see if it is.

I suspect that it will be marginally faster (because it won't need to do bound checks to go to the default case) but under PGO it will make almost no difference.

You can try to see if there is any significant improvement using the pyperformance suite (https://pyperformance.readthedocs.io/) with and without your change (with PGO/LTO activated).

----------
nosy: +pablogsal

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue39150>
_______________________________________


More information about the Python-bugs-list mailing list