[issue26098] PEP 510: Specialize functions with guards
STINNER Victor
report at bugs.python.org
Tue Feb 2 19:01:50 EST 2016
STINNER Victor added the comment:
Patch version 6: I inlined PyFunction_GetSpecializedCode() into fast_function() of Python/ceval.c. It reduces *a little bit* the overhead of the patch when specialization is not used, but it also avoids to expose this function. I don't think that it's worth to expose PyFunction_GetSpecializedCode(): it was only used in ceval.c. For example, I don't use it for unit tests. I prefer to write tests calling the function and checking the results (see test_pep510.py).
*Raw* overhead of specialized-6.patch on calling "def f(): pass": 1.7 nanoseconds. I computed the overhead using timeit:
./python -m timeit -s 'def f(): pass' 'f()'
* Original: 71.7 ns
* specialize-6.patch: 73.4 ns (+1.7 ns, +2.4%)
* specialize-5.patch: 74.3 ns (+2.6 ns, +3.6%)
I will run perf.py to see the overhead on a macro benchmark.
----------
Added file: http://bugs.python.org/file41786/specialize-6.patch
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue26098>
_______________________________________
More information about the Python-bugs-list
mailing list