mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-06 11:15:31 -05:00
refactor: have bench compile again
This commit is contained in:
parent
f41887c367
commit
bfaffc5c39
1 changed files with 7 additions and 7 deletions
|
|
@ -996,7 +996,7 @@ module Deque = struct
|
||||||
module type DEQUE = sig
|
module type DEQUE = sig
|
||||||
type 'a t
|
type 'a t
|
||||||
val create : unit -> 'a t
|
val create : unit -> 'a t
|
||||||
val of_seq : 'a Iter.t -> 'a t
|
val of_iter : 'a Iter.t -> 'a t
|
||||||
val iter : ('a -> unit) -> 'a t -> unit
|
val iter : ('a -> unit) -> 'a t -> unit
|
||||||
val push_front : 'a t -> 'a -> unit
|
val push_front : 'a t -> 'a -> unit
|
||||||
val push_back : 'a t -> 'a -> unit
|
val push_back : 'a t -> 'a -> unit
|
||||||
|
|
@ -1086,7 +1086,7 @@ module Deque = struct
|
||||||
in
|
in
|
||||||
iter first
|
iter first
|
||||||
|
|
||||||
let of_seq seq =
|
let of_iter seq =
|
||||||
let q =create () in seq (push_back q); q
|
let q =create () in seq (push_back q); q
|
||||||
|
|
||||||
let append_back ~into q = iter (push_back into) q
|
let append_back ~into q = iter (push_back into) q
|
||||||
|
|
@ -1100,7 +1100,7 @@ module Deque = struct
|
||||||
module FQueue : DEQUE = struct
|
module FQueue : DEQUE = struct
|
||||||
type 'a t = 'a CCFQueue.t ref
|
type 'a t = 'a CCFQueue.t ref
|
||||||
let create () = ref CCFQueue.empty
|
let create () = ref CCFQueue.empty
|
||||||
let of_seq s = ref (CCFQueue.of_seq s)
|
let of_iter s = ref (CCFQueue.of_iter s)
|
||||||
let iter f q = CCFQueue.iter f !q
|
let iter f q = CCFQueue.iter f !q
|
||||||
let push_front q x = q:= CCFQueue.cons x !q
|
let push_front q x = q:= CCFQueue.cons x !q
|
||||||
let push_back q x = q:= CCFQueue.snoc !q x
|
let push_back q x = q:= CCFQueue.snoc !q x
|
||||||
|
|
@ -1125,7 +1125,7 @@ module Deque = struct
|
||||||
let bench_iter n =
|
let bench_iter n =
|
||||||
let seq = Iter.(1 -- n) in
|
let seq = Iter.(1 -- n) in
|
||||||
let make (module D : DEQUE) =
|
let make (module D : DEQUE) =
|
||||||
let q = D.of_seq seq in
|
let q = D.of_iter seq in
|
||||||
fun () ->
|
fun () ->
|
||||||
let n = ref 0 in
|
let n = ref 0 in
|
||||||
D.iter (fun _ -> incr n) q;
|
D.iter (fun _ -> incr n) q;
|
||||||
|
|
@ -1163,8 +1163,8 @@ module Deque = struct
|
||||||
let bench_append n =
|
let bench_append n =
|
||||||
let seq = Iter.(1 -- n) in
|
let seq = Iter.(1 -- n) in
|
||||||
let make (module D :DEQUE) =
|
let make (module D :DEQUE) =
|
||||||
let q1 = D.of_seq seq in
|
let q1 = D.of_iter seq in
|
||||||
let q2 = D.of_seq seq in
|
let q2 = D.of_iter seq in
|
||||||
fun () -> D.append_back ~into:q1 q2
|
fun () -> D.append_back ~into:q1 q2
|
||||||
in
|
in
|
||||||
B.throughputN 3 ~repeat
|
B.throughputN 3 ~repeat
|
||||||
|
|
@ -1176,7 +1176,7 @@ module Deque = struct
|
||||||
let bench_length n =
|
let bench_length n =
|
||||||
let seq = Iter.(1--n) in
|
let seq = Iter.(1--n) in
|
||||||
let make (module D:DEQUE) =
|
let make (module D:DEQUE) =
|
||||||
let q = D.of_seq seq in
|
let q = D.of_iter seq in
|
||||||
fun () -> ignore (D.length q)
|
fun () -> ignore (D.length q)
|
||||||
in
|
in
|
||||||
B.throughputN 3 ~repeat
|
B.throughputN 3 ~repeat
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue