#suffix #search-index #search #index #saca

sacapart

Partitioned suffix arrays, for use with sacabase

1 stable release

2.0.0 Nov 23, 2019

#2652 in Algorithms

Download history 343/week @ 2024-07-21 362/week @ 2024-07-28 311/week @ 2024-08-04 338/week @ 2024-08-11 339/week @ 2024-08-18 548/week @ 2024-08-25 586/week @ 2024-09-01 764/week @ 2024-09-08 615/week @ 2024-09-15 745/week @ 2024-09-22 611/week @ 2024-09-29 759/week @ 2024-10-06 588/week @ 2024-10-13 833/week @ 2024-10-20 778/week @ 2024-10-27 823/week @ 2024-11-03

3,053 downloads per month
Used in 3 crates (2 directly)

MIT license

15KB
287 lines

sacapart

Computing the suffix array (the lexicographic order of all suffixes of a text) is expensive, especially as the text gets large.

Sometimes, for very large inputs, a compromise is possible. Instead of computing the suffix array of the whole text, we can compute the suffix array of the first half, and the suffix array of the second half.

Memory usage remains roughly the same (depending on the SACA used), lookup time gets worse by a constant factor (the number of partitions), and, across partitions boundaries, worse (shorter) matches are sometimes found.

For some applications, like diffing very large files, this compromise makes sense. Read the docs and the tests to see if sacapart is right for you.

Note: sacapart is meant to be used in conjuction with a SACA that supports sacabase, like divsufsort.

Dependencies

~1.5MB
~28K SLoC