more benchs

This commit is contained in:
Simon Cruanes 2024-01-10 12:48:27 -05:00
parent 813ea40ac5
commit cb949e4c7f
No known key found for this signature in database
GPG key ID: EBFFF6F283F3A2B4

View file

@ -56,10 +56,12 @@ module L = struct
let bench_map ?(time = 2) n = let bench_map ?(time = 2) n =
let l = CCList.(1 -- n) in let l = CCList.(1 -- n) in
let pv = Pvec.of_list l in
let ral = CCRAL.of_list l in let ral = CCRAL.of_list l in
let map_naive () = ignore (try List.map f_ l with Stack_overflow -> []) 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_naive2 () = ignore (try map_naive f_ l with Stack_overflow -> [])
and map_tailrec () = ignore (List.rev (List.rev_map f_ l)) 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 ccmap () = ignore (CCList.map f_ l)
and ralmap () = ignore (CCRAL.map ~f:f_ ral) in and ralmap () = ignore (CCRAL.map ~f:f_ ral) in
B.throughputN time ~repeat B.throughputN time ~repeat
@ -67,6 +69,7 @@ module L = struct
"List.map", map_naive, (); "List.map", map_naive, ();
"List.map(inline)", map_naive2, (); "List.map(inline)", map_naive2, ();
"List.rev_map o rev", map_tailrec, (); "List.rev_map o rev", map_tailrec, ();
"pvec.map", pvec_map, ();
"CCList.map", ccmap, (); "CCList.map", ccmap, ();
"CCRAL.map", ralmap, (); "CCRAL.map", ralmap, ();
] ]