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 rhpvorderman
Recipients Mark.Shannon, brett.cannon, rhettinger, rhpvorderman, serhiy.storchaka, tim.peters, vstinner, yselivanov
Date 2021-11-26.09:56:58
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1637920618.19.0.262249579765.issue45902@roundup.psfhosted.org>
In-reply-to
Content
I changed the cython script a bit to use a more naive implementation without memset.
Now it is always significantly faster than bytes(sorted(my_bytes)).

$ python -m timeit -c "from bytes_sort import bytes_sort" "bytes_sort(b'')"
500000 loops, best of 5: 495 nsec per loop
$ python -m timeit -c "from bytes_sort import bytes_sort" "bytes_sort(b'abc')"
500000 loops, best of 5: 519 nsec per loop
$ python -m timeit -c "from bytes_sort import bytes_sort" "bytes_sort(b'Let\'s test a proper string now. One that has some value to be sorted.')"
500000 loops, best of 5: 594 nsec per loop
History
Date User Action Args
2021-11-26 09:56:58rhpvordermansetrecipients: + rhpvorderman, tim.peters, brett.cannon, rhettinger, vstinner, Mark.Shannon, serhiy.storchaka, yselivanov
2021-11-26 09:56:58rhpvordermansetmessageid: <1637920618.19.0.262249579765.issue45902@roundup.psfhosted.org>
2021-11-26 09:56:58rhpvordermanlinkissue45902 messages
2021-11-26 09:56:58rhpvordermancreate