This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author sir-sigurd
Recipients Greg Price, aeros, malin, mark.dickinson, rhettinger, sir-sigurd
Date 2019-09-06.14:28:25
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1567780105.65.0.980302436578.issue38015@roundup.psfhosted.org>
In-reply-to
Content
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%)
History
Date User Action Args
2019-09-06 14:28:25sir-sigurdsetrecipients: + sir-sigurd, rhettinger, mark.dickinson, malin, Greg Price, aeros
2019-09-06 14:28:25sir-sigurdsetmessageid: <1567780105.65.0.980302436578.issue38015@roundup.psfhosted.org>
2019-09-06 14:28:25sir-sigurdlinkissue38015 messages
2019-09-06 14:28:25sir-sigurdcreate