mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-07 03:35:30 -05:00
add CCFun_vec to benchmarks
This commit is contained in:
parent
ccad1f3a2c
commit
deb266e1b3
1 changed files with 6 additions and 2 deletions
|
|
@ -110,14 +110,18 @@ module L = struct
|
|||
let bench_nth ?(time=2) n =
|
||||
let l = CCList.(1 -- n) in
|
||||
let ral = CCRAL.of_list l in
|
||||
let v = CCFun_vec.of_list l in
|
||||
let bench_list l () =
|
||||
for i = 0 to n-1 do ignore (List.nth l i) done
|
||||
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 ignore (CCRAL.get_exn l i) done
|
||||
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
|
||||
in
|
||||
B.throughputN time ~repeat
|
||||
[ "List.nth", bench_list l, ()
|
||||
; "RAL.get", bench_ral ral, ()
|
||||
; "funvec.get", bench_funvec v, ()
|
||||
]
|
||||
|
||||
(* MAIN *)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue