add BatVec to some benchmarks

This commit is contained in:
Simon Cruanes 2018-02-15 08:30:05 -06:00
parent deb266e1b3
commit 74d3b0f29f
2 changed files with 6 additions and 1 deletions

View file

@ -2,7 +2,8 @@
(executables
((names (run_benchs run_bench_hash))
(libraries (containers containers.data containers.iter
containers.thread benchmark gen sequence qcheck))
containers.thread benchmark gen sequence qcheck
batteries))
(flags (:standard -w +a-4-42-44-48-50-58-32-60@8 -safe-string -color always))
(ocamlopt_flags (:standard -O3 -color always
-unbox-closures -unbox-closures-factor 20))

View file

@ -111,17 +111,21 @@ module L = struct
let l = CCList.(1 -- n) in
let ral = CCRAL.of_list l in
let v = CCFun_vec.of_list l in
let bv = BatVect.of_list l in
let bench_list l () =
for i = 0 to n-1 do Sys.opaque_identity (ignore (List.nth l i)) done
and bench_ral l () =
for i = 0 to n-1 do Sys.opaque_identity (ignore (CCRAL.get_exn l i)) done
and bench_funvec l () =
for i = 0 to n-1 do Sys.opaque_identity (ignore (CCFun_vec.get_exn i l)) done
and bench_batvec l () =
for i = 0 to n-1 do Sys.opaque_identity (ignore (BatVect.get l i)) done
in
B.throughputN time ~repeat
[ "List.nth", bench_list l, ()
; "RAL.get", bench_ral ral, ()
; "funvec.get", bench_funvec v, ()
; "batvec.get", bench_batvec bv, ()
]
(* MAIN *)