mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-06 03:05:28 -05:00
add BatVec to some benchmarks
This commit is contained in:
parent
deb266e1b3
commit
74d3b0f29f
2 changed files with 6 additions and 1 deletions
|
|
@ -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))
|
||||
|
|
|
|||
|
|
@ -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 *)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue