[issue37483] Add PyObject_CallOneArg()
Jeroen Demeyer
report at bugs.python.org
Wed Jul 3 06:53:54 EDT 2019
Jeroen Demeyer <J.Demeyer at UGent.be> added the comment:
> Is there any benchmark showing if it's faster
Here is one example:
class D(dict):
def __missing__(self, key):
return None
d = D()
and now benchmark d[0]
**before**: Mean +- std dev: 173 ns +- 1 ns
**after**: Mean +- std dev: 162 ns +- 1 ns
To be precise, I ran: ./python -m perf timeit --duplicate 200 -s 'class D(dict):' -s ' def __missing__(self, key):' -s ' return None' -s 'd = D()' 'd[0]'
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue37483>
_______________________________________
More information about the Python-bugs-list
mailing list