Message283711
Proposed patch speeds up parsing positional arguments in PyArg_ParseTupleAndKeywords().
$ ./python -m perf timeit "1 .to_bytes(1, 'little', signed=False)"
Unpatched: Median +- std dev: 2.01 us +- 0.09 us
Patched: Median +- std dev: 1.23 us +- 0.03 us
Currently names of all passed positional argument are looked up in the kwargs dictionary for checking if the argument is passed as positional and keyword argument. With the patch this is checked only if there are unhandled keyword arguments after parsing keyword arguments that don't passed as positional arguments.
The same optimization also is applied to _PyArg_ParseTupleAndKeywordsFast() and like, but the effect is much smaller.
The patch also includes tiny refactoring. |
|
Date |
User |
Action |
Args |
2016-12-20 21:30:18 | serhiy.storchaka | set | recipients:
+ serhiy.storchaka |
2016-12-20 21:30:18 | serhiy.storchaka | set | messageid: <1482269418.38.0.550958237488.issue29029@psf.upfronthosting.co.za> |
2016-12-20 21:30:18 | serhiy.storchaka | link | issue29029 messages |
2016-12-20 21:30:18 | serhiy.storchaka | create | |
|