Message351255
I added similar patch that replaces get_small_int() with macro version, since it also induces unnecessary casts and makes machine code less efficient.
Example assembly can be checked at https://godbolt.org/z/1SjG3E.
This change produces tiny, but measurable speed-up for handling small ints:
$ python -m pyperf timeit -s "from collections import deque; consume = deque(maxlen=0).extend; r = range(256)" "consume(r)" --compare-to=../cpython-master/venv/bin/python --duplicate=1000
/home/sergey/tmp/cpython-master/venv/bin/python: ..................... 1.03 us +- 0.08 us
/home/sergey/tmp/cpython-dev/venv/bin/python: ..................... 973 ns +- 18 ns
Mean +- std dev: [/home/sergey/tmp/cpython-master/venv/bin/python] 1.03 us +- 0.08 us -> [/home/sergey/tmp/cpython-dev/venv/bin/python] 973 ns +- 18 ns: 1.05x faster (-5%) |
|
Date |
User |
Action |
Args |
2019-09-06 14:28:25 | sir-sigurd | set | recipients:
+ sir-sigurd, rhettinger, mark.dickinson, malin, Greg Price, aeros |
2019-09-06 14:28:25 | sir-sigurd | set | messageid: <1567780105.65.0.980302436578.issue38015@roundup.psfhosted.org> |
2019-09-06 14:28:25 | sir-sigurd | link | issue38015 messages |
2019-09-06 14:28:25 | sir-sigurd | create | |
|