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 xiang.zhang
Recipients martin.panter, r.david.murray, serhiy.storchaka, xiang.zhang
Date 2016-08-12.04:36:34
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1470976595.25.0.945480901758.issue27506@psf.upfronthosting.co.za>
In-reply-to
Content
So let's do a simple benchmark.

# without patch

./python -m timeit -s 'string=bytes(range(256));table=bytes(range(255, -1, -1));delete=b"abcdefghijklmn"' 'string.translate(table, delete)'
1000000 loops, best of 3: 0.55 usec per loop

# with patch

./python -m timeit -s 'string=bytes(range(256));table=bytes(range(255, -1, -1));delete=b"abcdefghijklmn"' 'string.translate(table, delete)'
1000000 loops, best of 3: 0.557 usec per loop

# keyword specified

./python -m timeit -s 'string=bytes(range(256));table=bytes(range(255, -1, -1));delete=b"abcdefghijklmn"' 'string.translate(table, delete=delete)'
1000000 loops, best of 3: 0.771 usec per loop

From my observation, the difference between PyArg_ParseTupleAndKeywords and PyArg_ParseTuple when parsing positional arguments is very small. This means it won't make old code slowdown by a large percent. And when keyword argument is specified, there is a degrade. But I think this happens everywhere using PyArg_ParseTupleAndKeywords.
History
Date User Action Args
2016-08-12 04:36:35xiang.zhangsetrecipients: + xiang.zhang, r.david.murray, martin.panter, serhiy.storchaka
2016-08-12 04:36:35xiang.zhangsetmessageid: <1470976595.25.0.945480901758.issue27506@psf.upfronthosting.co.za>
2016-08-12 04:36:35xiang.zhanglinkissue27506 messages
2016-08-12 04:36:34xiang.zhangcreate