[issue35582] Argument Clinic: inline parsing code for functions with only positional parameters

Serhiy Storchaka report at bugs.python.org
Fri Jan 11 10:41:27 EST 2019


Serhiy Storchaka <storchaka+cpython at gmail.com> added the comment:

PR 11520 additionally replaces PyArg_UnpackTuple() and _PyArg_UnpackStack() with _PyArg_CheckPositional() and inlined code in Argument Clinic.

Some examples for PR 11520:

$ ./python -m timeit "'abc'.strip()"
Unpatched:  5000000 loops, best of 5: 51.2 nsec per loop
Patched:    5000000 loops, best of 5: 45.8 nsec per loop

$ ./python -m timeit -s "d = {'a': 1}" "d.get('a')"
Unpatched:  5000000 loops, best of 5: 55 nsec per loop
Patched:    5000000 loops, best of 5: 51.1 nsec per loop

$ ./python -m timeit "divmod(5, 2)"
Unpatched:  5000000 loops, best of 5: 87 nsec per loop
Patched:    5000000 loops, best of 5: 80.6 nsec per loop

$ ./python -m timeit "hasattr(1, 'numerator')"
Unpatched:  5000000 loops, best of 5: 62.4 nsec per loop
Patched:    5000000 loops, best of 5: 54.8 nsec per loop

$ ./python -m timeit "isinstance(1, int)"
Unpatched:  5000000 loops, best of 5: 62.7 nsec per loop
Patched:    5000000 loops, best of 5: 54.1 nsec per loop

$ ./python -m timeit -s "from math import gcd" "gcd(6, 10)"
Unpatched:  2000000 loops, best of 5: 99.6 nsec per loop
Patched:    5000000 loops, best of 5: 89.9 nsec per loop

$ ./python -m timeit -s "from operator import add" "add(1, 2)"
Unpatched:  5000000 loops, best of 5: 40.7 nsec per loop
Patched:    10000000 loops, best of 5: 32.6 nsec per loop

----------

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


More information about the Python-bugs-list mailing list