Skip to content

Add: Bounded Levenshtein membership benchmarks - #9

Closed
grouville wants to merge 3 commits into
ashvardanian:mainfrom
grouville:levenshtein-within-k-bench
Closed

Add: Bounded Levenshtein membership benchmarks#9
grouville wants to merge 3 commits into
ashvardanian:mainfrom
grouville:levenshtein-within-k-bench

Conversation

@grouville

@grouvillegrouville commented Aug 15, 2026

Copy link
Copy Markdown

This PR adds a benchmark for checking whether every pair of strings is within a given Levenshtein distance.

I started it while working on StringZilla #336, but that work now focuses on a different use case: building a dictionary once and searching it many times

Benchmarks szs.LevenshteinWithinK (bound cross-product, cmp/s) against
cutoff-capable baselines: polyleven with a bound, rapidfuzz with
score_cutoff (scalar), and rapidfuzz cdist (batched, all cores) - the
strongest bounded-distance baseline.
Selectivity is controllable via STRINGWARS_WITHIN_CANDIDATES: 'random'
(reject-heavy natural mix, category within_k), 'mutated' (every candidate
is a within-bound mutation of its diagonal query, accept-heavy worst
case, category within_k_accepts), or 'both'. Bounds come from
STRINGWARS_WITHIN_K (default '1,2,4').
measure_crossproduct and measure_pairwise_baseline gain a report unit
parameter so membership kernels report pairs/s ('comparisons') instead
of CUPS, which misstates bounded kernels that never fill the DP matrix.
Signed-off-by: Guillaume de Rouville <guillaume.derouville@gmail.com>
Signed-off-by: Guillaume de Rouville <guillaume.derouville@gmail.com>
Signed-off-by: Guillaume de Rouville <guillaume.derouville@gmail.com>
@grouville
grouvilleforce-pushed the levenshtein-within-k-bench branch from 1f81925 to 37971bdCompareAugust 15, 2026 18:44
@grouville

grouville commented Aug 16, 2026

Copy link
Copy Markdown
Author

Closing this for now because StringZilla #336 no longer adds the dense all-pairs API measured here. I am keeping the branch so we can revisit the benchmark if we add that API later.

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@grouville