Skip to content

Compared with other libraries ​

Measured with npm run bench:versus on public data (Spotify song titles, the 20,000 most common English words, 151,000 world cities), Node 22, median of 7 runs. Every library gets the same inputs. Run it yourself: the numbers move a little from one machine to another.

string-similarity ​

fuzzy-toolkit/string-similarity returns exactly the same numbers as string-similarity (checked on 20,000 real pairs and thousands of random ones in the tests).

Taskstring-similarityfuzzy-toolkit
compareTwoStrings, 20,000 title pairs45 ms22 ms2× faster
findBestMatch, 1,000 queries × 2,000 titles4.0 s1.2 s3.2× faster

"Did you mean…?" ​

500 misspelled words against the 20,000 most common English words.

Right wordTime
string-similarity findBestMatch39.0 %6.9 s
fuzzy-toolkit createIndex(words).closest()93.4 %0.21 s (33× faster)

Search as you type ​

300 typed queries (the start of a title, with a typo) over 23,450 song titles, top 10.

Wanted title foundTime per query
Fuse.js65.3 %81.6 ms
fuzzysort21.7 %0.8 ms
fuzzy-toolkit createIndex(titles, { preset: 'search' })82.7 %11.0 ms

fuzzysort is the fastest but only matches letters in order, so a typo loses the result. fuzzy-toolkit finds more than Fuse.js, 7 times faster.

Acronyms ​

150 city names of 3 words or more typed as their initials (nyc), among 151,186 cities, top 10.

FoundTime per query
match-sorter59.3 %104 ms
fuzzy-toolkit createIndex(cities, { preset: 'search' })82.0 %19 ms

Levenshtein distance ​

Pairsfastest-levenshteinfuzzy-toolkit levenshtein
20,000 titles + 20,000 words24.7 ms15.0 ms (1.6×)
2,000 sentences of 100-400 characters, with typos25.1 ms11.9 ms (2.1×)

damerau (swapped letters count once) costs about the same: 12.4 ms on the sentences.

Dedupe ​

Time
dedupe(), 5,000 song titles, typos included1.1-1.4 s (4.5 s in v2.1)
dedupe(..., { method: 'fingerprint' }), 20,000 titles113 ms

Saved index ​

151,186 cities: createIndex takes 318 ms, loadIndex from JSON 155 ms. Fuse.js builds its (lighter) index in 31 ms, but searches it 5 to 10 times slower.

Size ​

Minified and gzipped, with npm run size:

ImportSize
levenshtein, damerau1.3 kB
fuzzy-toolkit/string-similarity0.8 kB
similarity, isMatch9.5 kB
check, checkAll10.2 kB
createIndex, search, highlight12.4 kB
createMatcher (every method)13.9 kB
everything17.0 kB
one extra language (lang/es)+0.6 kB

The package is marked "sideEffects": false, so bundlers keep only what you import. A matcher from createMatcher is one object with every method, so it always carries all of them: import the functions you call when size matters.