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

Andy Lester report at bugs.python.org
Thu Jan 9 10:16:43 EST 2020


Andy Lester <andy at petdance.com> added the comment:

Re: branch prediction.

The branch

    if (c1>=37 && c1<=126)

could just as easily be

    if (c1>=0 && c1<=126)

with no other changes to the code.  It could be just

    if (c1<=126)

if c1 wasn't signed.

As far as branch prediction, we could make it something like

    if (c1>=0 && c1<=255)

and expand the table lookup, depending on what the likely inputs are.  I could play around with that some if anyone was interested.

I'm not trying to push on this.  Just sharing some thoughts and research.

----------

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


More information about the Python-bugs-list mailing list