Skip to content

Commit

Permalink
Reduced default max fuzzy edit distance
Browse files Browse the repository at this point in the history
  • Loading branch information
darrenldl committed Sep 5, 2023
1 parent 054bb3d commit ff1ba93
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
- Performance tuning

- Switched back to using the old default max word search distance of 20
- Reduced default max fuzzy edit distance from 3 to 2 to prevent massive
slowdown on long words

## 1.3.2

Expand Down
2 changes: 1 addition & 1 deletion bin/params.ml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ include Docfd_lib.Params'

let debug = ref false

let default_max_fuzzy_edit_distance = 3
let default_max_fuzzy_edit_distance = 2

let max_fuzzy_edit_distance = ref default_max_fuzzy_edit_distance

Expand Down
13 changes: 11 additions & 2 deletions profile/main.ml
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,17 @@ let main _env =
let index = Index.of_lines (List.to_seq lines) in
let fuzzy_max_edit_distance = 3 in
let search_phrase = Search_phrase.make ~fuzzy_max_edit_distance ~phrase:"vestibul rutru" in
bench ~name:"Spelll.of_string" ~cycle:10 (fun () ->
Spelll.of_string ~limit:3 "Pellentesque");
let s = "PellentesquePellentesque" in
for len=1 to 20 do
let limit = 2 in
bench ~name:(Fmt.str "Spelll.of_string, limit: %d, len %2d:" limit len) ~cycle:10 (fun () ->
Spelll.of_string ~limit:2 (String.sub s 0 len))
done;
for len=1 to 20 do
let limit = 1 in
bench ~name:(Fmt.str "Spelll.of_string, limit: %d, len %2d:" limit len) ~cycle:10 (fun () ->
Spelll.of_string ~limit:1 (String.sub s 0 len))
done;
bench ~name:"Index.search" ~cycle:1000 (fun () ->
Index.search search_phrase index);
()
Expand Down

0 comments on commit ff1ba93

Please sign in to comment.