This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author serhiy.storchaka
Recipients serhiy.storchaka
Date 2016-12-20.21:30:17
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1482269418.38.0.550958237488.issue29029@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2016-12-20 21:30:18serhiy.storchakasetrecipients: + serhiy.storchaka
2016-12-20 21:30:18serhiy.storchakasetmessageid: <1482269418.38.0.550958237488.issue29029@psf.upfronthosting.co.za>
2016-12-20 21:30:18serhiy.storchakalinkissue29029 messages
2016-12-20 21:30:18serhiy.storchakacreate