mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-06 03:05:28 -05:00
perf: more bench for pvec
This commit is contained in:
parent
821fa6e3cf
commit
b49f358d47
1 changed files with 7 additions and 4 deletions
|
|
@ -191,10 +191,10 @@ module L = struct
|
||||||
opaque_ignore (Sek.Persistent.flatten s : _ Sek.Persistent.t)
|
opaque_ignore (Sek.Persistent.flatten s : _ Sek.Persistent.t)
|
||||||
and funvec_flatten v () =
|
and funvec_flatten v () =
|
||||||
opaque_ignore
|
opaque_ignore
|
||||||
(CCFun_vec.fold_rev ~x:CCFun_vec.empty
|
(CCFun_vec.fold ~x:CCFun_vec.empty ~f:CCFun_vec.append v
|
||||||
~f:(fun acc x -> CCFun_vec.append x acc)
|
|
||||||
v
|
|
||||||
: _ CCFun_vec.t)
|
: _ CCFun_vec.t)
|
||||||
|
and pvec_flatten v () =
|
||||||
|
opaque_ignore (Pvec.fold_left Pvec.append Pvec.empty v : _ Pvec.t)
|
||||||
in
|
in
|
||||||
let l =
|
let l =
|
||||||
CCList.mapi (fun i x -> CCList.(x -- (x + min i 100))) CCList.(1 -- n)
|
CCList.mapi (fun i x -> CCList.(x -- (x + min i 100))) CCList.(1 -- n)
|
||||||
|
|
@ -204,12 +204,15 @@ module L = struct
|
||||||
(List.map (Sek.Persistent.of_list 0) l)
|
(List.map (Sek.Persistent.of_list 0) l)
|
||||||
in
|
in
|
||||||
let v = CCFun_vec.of_list (List.map CCFun_vec.of_list l) in
|
let v = CCFun_vec.of_list (List.map CCFun_vec.of_list l) in
|
||||||
|
let pv = Pvec.of_list (List.map Pvec.of_list l) in
|
||||||
|
|
||||||
B.throughputN time ~repeat
|
B.throughputN time ~repeat
|
||||||
[
|
[
|
||||||
"CCList.flatten", (fun () -> ignore (CCList.flatten l)), ();
|
"CCList.flatten", (fun () -> ignore (CCList.flatten l)), ();
|
||||||
"List.flatten", (fun () -> ignore (List.flatten l)), ();
|
"List.flatten", (fun () -> ignore (List.flatten l)), ();
|
||||||
"fold_right append", fold_right_append_ l, ();
|
"fold_right append", fold_right_append_ l, ();
|
||||||
"funvec.(fold_right append)", funvec_flatten v, ();
|
"funvec.(fold append)", funvec_flatten v, ();
|
||||||
|
"pvec.(fold append)", pvec_flatten pv, ();
|
||||||
"CCList.(fold_right append)", cc_fold_right_append_ l, ();
|
"CCList.(fold_right append)", cc_fold_right_append_ l, ();
|
||||||
"Sek.flatten", sek_flatten sek, ();
|
"Sek.flatten", sek_flatten sek, ();
|
||||||
]
|
]
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue