mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-06 11:15:31 -05:00
add .replace operation in benchs
This commit is contained in:
parent
d19abf889c
commit
484653fb08
1 changed files with 29 additions and 0 deletions
|
|
@ -24,6 +24,35 @@ let _ =
|
||||||
in
|
in
|
||||||
Bench.summarize 1. res
|
Bench.summarize 1. res
|
||||||
|
|
||||||
|
let phashtbl_replace n =
|
||||||
|
let h = PHashtbl.create 50 in
|
||||||
|
for i = 0 to n do
|
||||||
|
PHashtbl.replace h i i;
|
||||||
|
done;
|
||||||
|
for i = 0 to n do
|
||||||
|
PHashtbl.replace h i i;
|
||||||
|
done;
|
||||||
|
h
|
||||||
|
|
||||||
|
let hashtbl_replace n =
|
||||||
|
let h = Hashtbl.create 50 in
|
||||||
|
for i = 0 to n do
|
||||||
|
Hashtbl.replace h i i;
|
||||||
|
done;
|
||||||
|
for i = 0 to n do
|
||||||
|
Hashtbl.replace h i i;
|
||||||
|
done;
|
||||||
|
h
|
||||||
|
|
||||||
|
let _ =
|
||||||
|
let n = 50000 in
|
||||||
|
let res = Bench.bench_funs
|
||||||
|
["phashtbl_replace", (fun n -> ignore (phashtbl_replace n));
|
||||||
|
"hashtbl_replace", (fun n -> ignore (hashtbl_replace n));]
|
||||||
|
n
|
||||||
|
in
|
||||||
|
Bench.summarize 1. res
|
||||||
|
|
||||||
let phashtbl_mem h =
|
let phashtbl_mem h =
|
||||||
fun n ->
|
fun n ->
|
||||||
for i = 0 to n do
|
for i = 0 to n do
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue