Xiang Zhang added the comment: 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. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue27506> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com