add .replace operation in benchs

This commit is contained in:
Simon Cruanes 2013-03-04 18:21:26 +01:00
parent d19abf889c
commit 484653fb08

View file

@ -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