[issue29461] Experiment usage of likely/unlikely in CPython core

STINNER Victor report at bugs.python.org
Mon Feb 6 05:40:01 EST 2017


STINNER Victor added the comment:

Benchmarks with Python compiled by gcc -O3 (without PGO).

haypo at smithers$ ./python -m perf timeit 'len("abc")' --duplicate=1000 --compare-to=../default-ref/python
Median +- std dev: [ref] 40.4 ns +- 0.8 ns -> [likely] 40.8 ns +- 2.1 ns: 1.01x slower (+1%)

haypo at smithers$ ./python -m perf timeit 'sum(())' --duplicate=1000 --compare-to=../default-ref/python -p3
Median +- std dev: [ref] 86.4 ns +- 2.8 ns -> [likely] 86.3 ns +- 0.3 ns: 1.00x faster (-0%)
Not significant!

haypo at smithers$ ./python -m perf timeit -s 's=list("abc")' 'sorted(s)' --duplicate=100 --compare-to=../default-ref/python -p3
Median +- std dev: [ref] 224 ns +- 3 ns -> [likely] 222 ns +- 1 ns: 1.01x faster (-1%)

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue29461>
_______________________________________


More information about the Python-bugs-list mailing list