Message407040
Sorry for the spam. I see I made a typo in the timeit script. Next time I will be more dilligent when making these kinds of reports and triple checking it before hand, and sending it once. I used -c instead of -s and now all the setup time is also included. This confounds the results.
The proper test commands should be:
python -m timeit -s "from bytes_sort import bytes_sort, bytearray_sort_inplace" "bytes_sort(b'My string here')"
python -m timeit "bytes(sorted(b'My string here'))"
Using just sorted, to purely compare the sorting algorithms without the overhead of creating a new bytes object.
python -m timeit "sorted(b'My string here')"
Correct comparison results
# String = b''
using bytes(sorted: 188 nsec
using sorted: 108 nsec
using byte_sort: 125 nsec # Some overhead here, setting up the countarray
# String = b'abc'
using bytes(sorted: 252 nsec
using sorted: 145 nsec
using byte_sort: 136 nsec # Overhead compared to sorted already negated when sorting 3 items(!)
# String = b'Let\'s test a proper string now. One that has some value to be sorted.'
using bytes(sorted: 1830 nsec (reported as 1.83 usec)
using sorted: 1550 nsec (reported as 1.55 usec)
using byte_sort: 220 nsec |
|
Date |
User |
Action |
Args |
2021-11-26 10:51:32 | rhpvorderman | set | recipients:
+ rhpvorderman, tim.peters, brett.cannon, rhettinger, vstinner, Mark.Shannon, serhiy.storchaka, yselivanov |
2021-11-26 10:51:31 | rhpvorderman | set | messageid: <1637923892.0.0.795563038623.issue45902@roundup.psfhosted.org> |
2021-11-26 10:51:31 | rhpvorderman | link | issue45902 messages |
2021-11-26 10:51:31 | rhpvorderman | create | |
|