#saca #suffix #search #index


Rust port of Yuta Mori's divsufsort

4 stable releases

2.0.0 Nov 23, 2019
1.0.2 Nov 17, 2019
1.0.0 Nov 16, 2019

#1105 in Algorithms

Download history 1065/week @ 2023-08-11 2065/week @ 2023-08-18 1565/week @ 2023-08-25 1735/week @ 2023-09-01 1861/week @ 2023-09-08 1712/week @ 2023-09-15 1642/week @ 2023-09-22 1242/week @ 2023-09-29 404/week @ 2023-10-06 183/week @ 2023-10-13 254/week @ 2023-10-20 238/week @ 2023-10-27 175/week @ 2023-11-03 148/week @ 2023-11-10 171/week @ 2023-11-17 109/week @ 2023-11-24

634 downloads per month
Used in 5 crates (4 directly)

MIT license

3.5K SLoC


This crate contains a Rust handmade port of Yuta Mori's libdivsufsort, as found on:


The main changes from the C codebase are as follows.

Instead of passing pointers to T (the original text) and SA (the suffix array), slices and indices are passed instead. This sometimes involves adding more parameters to functions (like tr_heapsort).

Some macros (for stacks, used in sssort and trsort) have been replaced with proper Rust types. The SAPtr type is used to represent an index into SA. A/B/B* access has also been translated from C macros to Rust (inlined) functions.

Cross-checking is only built when the crosscheck feature is enabled. It is not intended for general use, only for debugging the divsufsort crate.


The original C code was written by Yuta Mori.

The port was done by hand, by Amos Wenger.


divsufsort is released under the MIT license, same as the original.

See the LICENSE file for details.