Skip to content
Kotoshu Kotoshu 言修
News

2026-09-07 release. 7 September 2026

Suggestion sweeps complete in under a second with @kotoshu/wasm 0.3.1

The suggestion sweep is 10 to 200x faster on full dictionaries, returning the same suggestions byte for byte in milliseconds instead of seconds.

  1. A full-en_US sweep had been taking seconds, with Teh at 3.6 s, recieve at 17.3 s, and mispellings at 38.4 s measured over the published 0.3.0 module, because four allocation and scan patterns compounded per dictionary word: find_word scanned the whole word list per keyboard variant with a lowercase allocation per word, the n-gram strategy built a map of String trigrams per dictionary word, Soundex allocated a String per word, and the edit loops allocated a fresh char vector per word.
  2. The sweep now builds one word index per call (exact set plus lowercase-form map, borrowed for words already lowercase), packs trigrams into fixed-width integer keys in a reused scratch map with a length pre-gate, compares fixed Soundex keys, and reuses char buffers. Outputs are byte-identical: the 2630 conformance vectors all pass, and the benchmark set returns the same lists — Teh 320 ms, mispellings 189 ms, definately 145 ms, recieve 93 ms.
  3. The playground also sweeps as one batch now: the misspellings pane sends a single message for all its words, the worker walks the queue with a yield between words so a popover click jumps ahead, and a fresh check replaces the pending batch instead of stacking behind it.

see also @kotoshu/wasm on npm kotoshu-rs PR #21 — the indexed sweep Playground