Skip to content

Commit

Permalink
more benchs
Browse files Browse the repository at this point in the history
  • Loading branch information
c-cube committed Jan 10, 2024
1 parent 813ea40 commit cb949e4
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions benchs/run_benchs.ml
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,20 @@ module L = struct

let bench_map ?(time = 2) n =
let l = CCList.(1 -- n) in
let pv = Pvec.of_list l in
let ral = CCRAL.of_list l in
let map_naive () = ignore (try List.map f_ l with Stack_overflow -> [])
and map_naive2 () = ignore (try map_naive f_ l with Stack_overflow -> [])
and map_tailrec () = ignore (List.rev (List.rev_map f_ l))
and pvec_map () = ignore (Pvec.map f_ pv)
and ccmap () = ignore (CCList.map f_ l)
and ralmap () = ignore (CCRAL.map ~f:f_ ral) in
B.throughputN time ~repeat
[
"List.map", map_naive, ();
"List.map(inline)", map_naive2, ();
"List.rev_map o rev", map_tailrec, ();
"pvec.map", pvec_map, ();
"CCList.map", ccmap, ();
"CCRAL.map", ralmap, ();
]
Expand Down

0 comments on commit cb949e4

Please sign in to comment.