報せNews
2026-09-07 報 release. 7 September 2026
The per-dictionary sweep index ships in @kotoshu/wasm 0.3.2
Per-word sweep invariants now live in a per-dictionary index built once at the first sweep, so heavy dictionaries gain another 1.2 to 6x, Portuguese foremost.
- The 0.3.1 rewrite still walked the whole word list per sweep, decoding each word before its gate — the length window, the Soundex code, the n-gram length bound — all values that never change with the query. 0.3.2 builds them once per dictionary: char lengths, Soundex codes packed into four bytes, and length buckets that let the edit-distance sweep touch only its two-length window (word-list order restored before the ranking sort, so tie order and outputs are untouched).
- Benchmarks over the pinned dictionaries show the average per sweep dropping for Portuguese from 1,398 to 423 ms with the worst case from 1,931 to 656 ms, for Spanish from 522 to 89 ms, for Norwegian from 346 to 277 ms, for German from 184 to 148 ms, for Russian from 226 to 205 ms, for Italian from 144 to 127 ms, and for English from 52 to 45 ms. The one remaining heavy case is a short French word whose length window covers a dense slice of the French vocabulary, which is the floor for this algorithm as frozen by the conformance contract.
- Conformance unchanged at 2,630 vectors, outputs byte-identical; every transposed-word typo in the benchmark still recovers its intended word in the top five.
see also @kotoshu/wasm on npm kotoshu-rs PR #23 — the sweep index Playground