Message349540
When compiled with default NSMALLPOSINTS, _PyLong_FromUnsignedChar() is significantly faster than other PyLong_From*():
$ python -m perf timeit -s "from collections import deque; consume = deque(maxlen=0).extend; b = bytes(2**20)" "consume(b)" --compare-to=../cpython-master/venv/bin/python
/home/sergey/tmp/cpython-master/venv/bin/python: ..................... 7.10 ms +- 0.02 ms
/home/sergey/tmp/cpython-dev/venv/bin/python: ..................... 4.29 ms +- 0.03 ms
Mean +- std dev: [/home/sergey/tmp/cpython-master/venv/bin/python] 7.10 ms +- 0.02 ms -> [/home/sergey/tmp/cpython-dev/venv/bin/python] 4.29 ms +- 0.03 ms: 1.66x faster (-40%)
It's mostly useful for bytes/bytearray, but also can be used in several other places. |
|
Date |
User |
Action |
Args |
2019-08-13 10:29:55 | sir-sigurd | set | recipients:
+ sir-sigurd |
2019-08-13 10:29:55 | sir-sigurd | set | messageid: <1565692195.8.0.862568192553.issue37837@roundup.psfhosted.org> |
2019-08-13 10:29:55 | sir-sigurd | link | issue37837 messages |
2019-08-13 10:29:55 | sir-sigurd | create | |
|