From edccae0c89d8a7aebba6265f23815f58d8bbf7e0 Mon Sep 17 00:00:00 2001 From: Simon Cruanes Date: Sat, 3 Apr 2021 01:10:36 -0400 Subject: [PATCH] update benchs --- benchs/run_benchs.ml | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/benchs/run_benchs.ml b/benchs/run_benchs.ml index 707c22f9..8492d809 100644 --- a/benchs/run_benchs.ml +++ b/benchs/run_benchs.ml @@ -751,6 +751,7 @@ module Tbl = struct ; wbt Str ; hashtrie Str ; persistent_hashtbl Str + ; flat_tbl Str (* ; hamt Str *) ; trie ] @@ -800,6 +801,21 @@ module Tbl = struct in B.throughputN 3 ~repeat (List.map make modules_int) + let bench_replace_string_to l n = + let keys = CCList.( 1 -- n |> map (fun i->string_of_int i,i)) in + let make (module T : STRING_MUT) = + let run() = + let t = T.create 50 in + List.iter + (fun (k,v) -> T.replace t k v) + keys + in + T.name, run, () + in + B.throughputN 3 ~repeat (List.map make l) + + let bench_replace_string = bench_replace_string_to modules_string + module type INT_FIND = sig type 'a t val name : string @@ -875,7 +891,8 @@ module Tbl = struct B.Tree.register ("tbl" @>>> [ "add_int" @>> app_ints bench_add [10; 100; 1_000; 10_000;] ; "add_string" @>> app_ints bench_add_string [10; 100; 1_000; 10_000;] - ; "replace" @>> app_ints bench_replace [10; 100; 1_000; 10_000] + ; "replace_int" @>> app_ints bench_replace [10; 100; 1_000; 10_000] + ; "replace_string" @>> app_ints bench_replace_string [10; 100; 1_000; 10_000] ; "find" @>> app_ints bench_find [10; 20; 100; 1_000; 10_000] ; "find_string" @>> app_ints bench_find_string [10; 20; 100; 1_000; 10_000] ]);