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
- Host: GitHub
- URL: https://github.com/rhpvorderman/bytes_sort
- Owner: rhpvorderman
- Created: 2021-11-26T09:13:33.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2021-11-26T10:53:42.000Z (over 3 years ago)
- Last Synced: 2025-01-17T08:43:59.272Z (5 months ago)
- Language: Cython
- Size: 4.88 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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