Repository navigation
Releases
Releases · wolfgarbe/symspell_rs
SymSpell v7.0.1
- New basic benchmark added
- Lookup latency experiments (162 in total): the 30k, 82k and 500k English frequency dictionaries ×
prefix_length5, 6, 7 × maximum edit distance 1, 2, 3 ×VerbosityTop, Closest, All × {this version, symspell_rs 6.8.4}. - Load dictionary time experiments (27 in total): the 30k, 82k and 500k English frequency dictionaries ×
prefix_length5, 6, 7 × maximum edit distance 1, 2, 3 - Damerau-Levenshtein OSA latency experiments (6 in total): maximum edit distance 1, 2, 3 x bit-parallel OSA, multi-word block bit-parallel OSA
- Basic benchmark:
cargo bench --bench basic --features gxhash - Verbose benchmark, including RAM consumption, based on divan:
cargo bench --bench verbose --features gxhash - See detailed benchmark results.
- Lookup latency experiments (162 in total): the 30k, 82k and 500k English frequency dictionaries ×
SymSpell v7.0.0
Changed
- Internal storage:
wordsnow maps terms to ids, and counts live in a new term table. Serialized dictionaries from previous versions (serdefeature) are not compatible. - The derived
PartialEqonSymSpellcompares term ids, so dictionaries with the same content but a different insertion order compare unequal. - ASCII input now takes an allocation-free fast path: stack-based candidates, borrowed hits, and
Suggestionstrings created only for the returned results (after sort andmax_results). Non-ASCII input uses a char-based path that shares the same verification code. - Delete buckets store compact 8-byte entries (term id, length, ASCII flag) that refer to a shared term table, instead of a heap copy of the term per delete. This lowers memory use and removes pointer chasing.
- The
deletesmap uses a lightweight hasher, since its keys are already 32-bit hashes.
Added
lookupbenchmark (benchmark/lookup.rs) based on divan. Run it withcargo bench.- Queries: the first term of each line of
benchmark/test_data/noisy_query_en_1000.txt(1000 misspelled terms). - Experiments (162 in total): the 30k, 82k and 500k English frequency dictionaries ×
prefix_length5, 6, 7 × maximum edit distance 1, 2, 3 ×VerbosityTop, Closest, All × {this version, symspell_rs 6.8.4}. The dictionary is rebuilt for each maximum edit distance (maximum dictionary edit distance = maximum edit distance). 6.8.4 is pulled in as the dev-dependencysymspell_old. - Measured per experiment: the time of one pass over all queries (reported by divan as items/s), the average latency per
lookup(), and the peak heap allocation during lookups (via a tracking global allocator). - Measured per dictionary build: build time, resident memory and peak memory during the build, for both versions.
- After each 6.8.4 run, the benchmark prints the latency speedup and the peak-allocation ratio of this version relative to 6.8.4.
- The average latency and memory figures are printed to stderr next to the divan output.
- Run a subset with a divan filter, e.g.
cargo bench -- 82_765.
Performance: 3x faster lookup, 40% less memory consumption.
- Faster lookups in every experiment. All 81 lookup experiments are faster, by a geometric mean of 2.8× (range 1.5× to 5.9×).
Verbosity::Top: 3.0× on average (1.8× to 5.9×)Verbosity::Closest: 2.9× on average (1.5× to 4.2×)Verbosity::All: 2.7× on average (1.6× to 4.8×)- max edit distance 1: 2.4× on average (1.5× to 3.7×)
- max edit distance 2: 2.8× on average (2.1× to 5.2×)
- max edit distance 3: 3.4× on average (1.8× to 5.9×)
- 30,000-word dictionary: 2.9× on average (1.5× to 4.8×)
- 82,765-word dictionary: 3.0× on average (1.8× to 5.9×)
- 500,000-word dictionary: 2.6× on average (1.6× to 3.5×)
- Much lower memory use during lookups. Peak heap allocation per lookup is on average only 31% of v6.8.4 (best case 17%, worst case 77%).
Verbosity::Top: 18% of v6.8.4 on average (17% to 18%)Verbosity::Closest: 32% of v6.8.4 on average (18% to 73%)Verbosity::All: 52% of v6.8.4 on average (33% to 77%)
- Roughly 40% less memory for the dictionary. Resident memory after the build is on average 62% of v6.8.4 (best case 48%, worst case 83%). Peak memory during the build is on average 64% of v6.8.4 (48% to 88%).
- Largest example, 500k dictionary, prefix 7, edit distance 3: resident memory 874 MiB → 436 MiB, peak 874 MiB → 436 MiB, build time 14.20 s → 12.60 s.
- See detailed benchmark results.
SymSpell v6.9.1
Improved
- Optimized
damerau_levenshtein_osa_fallbackby using the multi-word block version of the bit-parallel algorithm (Hyyrö 2003), to cover any length., making it 5x faster thanstrsim.osa_distancefor terms > 64 chars.
SymSpell v6.9.0
Improved
- Optimized
damerau_levenshtein_osaby using bit-parallel OSA (Hyyrö 2003), making it 8x faster thanstrsim.osa_distanceand boosting SymSpell lookup speeds by 20%. - Exposed
damerau_levenshtein_osaas a public method for standalone use.
SymSpell v6.8.4
Changed
- Explicit activation of new
gxhash-feature for high-performance hashing viagxhash, both forx86_64andaarch64. Enable thegxhash-feature:- If compiling for x86_64 AND explicitly targeted AES/SSE2:
#[cfg(all(target_arch = "x86_64", target_feature = "aes", target_feature = "sse2"))]or - If compiling for ARM64 AND explicitly targeted AES/NEON
#[cfg(all(target_arch = "aarch64", target_feature = "aes", target_feature= "neon"))] - Otherwise fallback to
ahash.
- If compiling for x86_64 AND explicitly targeted AES/SSE2:
SymSpell v6.8.3
- Gracefully handle empty input strings for word_segmentation. Fixes #1 .
SymSpell v6.8.2
lookup_compoundnow also with new parameterterm_length_threshold.
SymSpell v6.8.1
- README.md included in documentation tests (doctest) to ensure that code examples are always correct and up-to-date.
SymSpell v6.8.0
Added
create_dictionary_entryexposed as public method, for incremental dictionary update.save_dictionaryto write the dictionary to a CSV file.lookup()with new parametermax_resultsto limit the number of suggestion returned.SymSpell::new()andlookup()with new parameterterm_length_threshold: A vector of term length thresholds for each maximum edit distance.
Allowing higher maximum edit distances for longer terms, with minimal additional latency and memory consumption.- None: max_dictionary_edit_distance for all terms lengths
- Some([4].into()): max_dictionary_edit_distance for all terms lengths >= 4,
- Some([2,8].into()): max_dictionary_edit_distance for all terms lengths >=2, max_dictionary_edit_distance +1 for all terms for lengths>=8
Fixed
- In
create_dictionary_entrywords weren't added as stub for count < count_threshold, which is required for correct incremental directory entry creation and counting.
Changed
- Refactoring.
- hash64 replaced with hash32.
SymSpell v6.7.8
- Sort order for suggestions fixed.