Author sir-sigurd
Recipients sir-sigurd
Date 2019-08-13.10:29:55
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1565692195.8.0.862568192553.issue37837@roundup.psfhosted.org>
In-reply-to
Content
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.
History
Date User Action Args
2019-08-13 10:29:55sir-sigurdsetrecipients: + sir-sigurd
2019-08-13 10:29:55sir-sigurdsetmessageid: <1565692195.8.0.862568192553.issue37837@roundup.psfhosted.org>
2019-08-13 10:29:55sir-sigurdlinkissue37837 messages
2019-08-13 10:29:55sir-sigurdcreate