An open API service indexing awesome lists of open source software.

https://github.com/rhpvorderman/bytes_sort

Example implementation for bytes sorting in CPython
https://github.com/rhpvorderman/bytes_sort

Last synced: 3 months ago
JSON representation

Example implementation for bytes sorting in CPython

Awesome Lists containing this project

README

        

# bytes_sort
Illustration of usefullness of adding `bytes.sort()` and `bytesarray.sort()` methods in CPython using a counting sort as implementation.
This is much faster than using `sorted` from the builtins.

To test:
- `pip install cython`
- `cythonize -i bytes_sort.pyx`
- `python -m timeit -s "from bytes_sort import bytes_sort, bytearray_sort_inplace" "bytes_sort(b'My string here')"`
- Comparison with current stdlib `python -m timeit "bytes(sorted(b'My string here'))"`

https://bugs.python.org/issue45902