diff --git a/CHANGELOG.md b/CHANGELOG.md index e953933..9eaaaaa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/bin/params.ml b/bin/params.ml index 27023b3..34bf711 100644 --- a/bin/params.ml +++ b/bin/params.ml @@ -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 diff --git a/profile/main.ml b/profile/main.ml index 422672a..aa87af6 100644 --- a/profile/main.ml +++ b/profile/main.ml @@ -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); ()