mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-06 11:15:31 -05:00
improvements
This commit is contained in:
parent
d923795e1a
commit
df5151636b
5 changed files with 12 additions and 11 deletions
|
|
@ -3,6 +3,6 @@
|
||||||
(libraries containers containers-data
|
(libraries containers containers-data
|
||||||
containers-thread benchmark gen iter qcheck oseq
|
containers-thread benchmark gen iter qcheck oseq
|
||||||
batteries base sek)
|
batteries base sek)
|
||||||
(flags :standard -warn-error -3 -safe-string -color always -open CCShims_)
|
(flags :standard -warn-error -3-5 -safe-string -color always -open CCShims_)
|
||||||
(ocamlopt_flags :standard -O3 -color always
|
(ocamlopt_flags :standard -O3 -color always
|
||||||
-unbox-closures -unbox-closures-factor 20))
|
-unbox-closures -unbox-closures-factor 20))
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
(** Generic benchs *)
|
(** Generic benchs *)
|
||||||
|
|
||||||
|
[@@@warning "-5"]
|
||||||
|
|
||||||
module B = Benchmark
|
module B = Benchmark
|
||||||
let (@>) = B.Tree.(@>)
|
let (@>) = B.Tree.(@>)
|
||||||
let (@>>) = B.Tree.(@>>)
|
let (@>>) = B.Tree.(@>>)
|
||||||
|
|
@ -952,7 +954,7 @@ module Iter_ = struct
|
||||||
if !saw_x then (saw_x := true; Some x)
|
if !saw_x then (saw_x := true; Some x)
|
||||||
else xs ()
|
else xs ()
|
||||||
in
|
in
|
||||||
let xs = Array.init n Fun.id in
|
let xs = Array.init n CCFun.id in
|
||||||
let iter () = ignore (Array.fold_right Iter.cons xs Iter.empty : int Iter.t) in
|
let iter () = ignore (Array.fold_right Iter.cons xs Iter.empty : int Iter.t) in
|
||||||
let gen () = ignore (Array.fold_right gen_cons xs Gen.empty : int Gen.t) in
|
let gen () = ignore (Array.fold_right gen_cons xs Gen.empty : int Gen.t) in
|
||||||
let oseq () = ignore (Array.fold_right OSeq.cons xs OSeq.empty : int OSeq.t) in
|
let oseq () = ignore (Array.fold_right OSeq.cons xs OSeq.empty : int OSeq.t) in
|
||||||
|
|
@ -969,7 +971,7 @@ module Iter_ = struct
|
||||||
if !saw_x then (saw_x := true; Some x)
|
if !saw_x then (saw_x := true; Some x)
|
||||||
else xs ()
|
else xs ()
|
||||||
in
|
in
|
||||||
let xs = Array.init n Fun.id in
|
let xs = Array.init n CCFun.id in
|
||||||
let iter () = Iter.fold (+) 0 (Array.fold_right Iter.cons xs Iter.empty) in
|
let iter () = Iter.fold (+) 0 (Array.fold_right Iter.cons xs Iter.empty) in
|
||||||
let gen () = Gen.fold (+) 0 (Array.fold_right gen_cons xs Gen.empty) in
|
let gen () = Gen.fold (+) 0 (Array.fold_right gen_cons xs Gen.empty) in
|
||||||
let oseq () = OSeq.fold (+) 0 (Array.fold_right OSeq.cons xs OSeq.empty) in
|
let oseq () = OSeq.fold (+) 0 (Array.fold_right OSeq.cons xs OSeq.empty) in
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
(* module Deque = Core_kernel.Deque *)
|
(* module Deque = Core_kernel.Deque *)
|
||||||
module Int_map = Map.Make(CCInt)
|
module Int_map = CCMap.Make(CCInt)
|
||||||
module Int_set = Set.Make(CCInt)
|
module Int_set = CCSet.Make(CCInt)
|
||||||
|
|
||||||
let dup = CCPair.dup
|
let dup = CCPair.dup
|
||||||
let id = CCFun.id
|
let id = CCFun.id
|
||||||
|
|
@ -19,10 +19,10 @@ let dummy = 0
|
||||||
let types = [
|
let types = [
|
||||||
"Stdlib.List", (fun n -> Obj.magic @@ ns n);
|
"Stdlib.List", (fun n -> Obj.magic @@ ns n);
|
||||||
"Stdlib.Array", (fun n -> Obj.magic @@ Array.init n id);
|
"Stdlib.Array", (fun n -> Obj.magic @@ Array.init n id);
|
||||||
"Stdlib.Hashtbl", (fun n -> Obj.magic @@ Hashtbl.of_seq (OSeq.init ~n dup));
|
"Stdlib.Hashtbl", (fun n -> Obj.magic @@ CCHashtbl.of_iter Iter.(init dup |> take n));
|
||||||
"Base.Hashtbl", (fun n -> Obj.magic @@ Base.Hashtbl.Poly.of_alist_exn (List.init n dup));
|
"Base.Hashtbl", (fun n -> Obj.magic @@ Base.Hashtbl.Poly.of_alist_exn (List.init n dup));
|
||||||
"Stdlib.Map", (fun n -> Obj.magic @@ Int_map.of_seq (OSeq.init ~n dup));
|
"Stdlib.Map", (fun n -> Obj.magic @@ Int_map.of_iter Iter.(init dup |> take n));
|
||||||
"Stdlib.Set", (fun n -> Obj.magic @@ Int_set.of_seq (OSeq.init ~n id));
|
"Stdlib.Set", (fun n -> Obj.magic @@ Int_set.of_iter Iter.(init id |> take n));
|
||||||
"CCFun_vec", (fun n -> Obj.magic @@ CCFun_vec.of_list (ns n));
|
"CCFun_vec", (fun n -> Obj.magic @@ CCFun_vec.of_list (ns n));
|
||||||
"CCRAL", (fun n -> Obj.magic @@ CCRAL.of_list (ns n));
|
"CCRAL", (fun n -> Obj.magic @@ CCRAL.of_list (ns n));
|
||||||
"BatVect", (fun n -> Obj.magic @@ BatVect.of_list (ns n));
|
"BatVect", (fun n -> Obj.magic @@ BatVect.of_list (ns n));
|
||||||
|
|
@ -31,7 +31,7 @@ let types = [
|
||||||
"CCVector", (fun n -> Obj.magic @@ let c = CCVector.create () in iter_range n (CCVector.push c); c);
|
"CCVector", (fun n -> Obj.magic @@ let c = CCVector.create () in iter_range n (CCVector.push c); c);
|
||||||
(* "Core_kernel.Deque", (fun n -> Obj.magic @@ let c = Deque.create () in iter_range n (Deque.enqueue_back c); c); *)
|
(* "Core_kernel.Deque", (fun n -> Obj.magic @@ let c = Deque.create () in iter_range n (Deque.enqueue_back c); c); *)
|
||||||
"Base.Queue", (fun n -> Obj.magic @@ let c = Base.Queue.create () in iter_range n (Base.Queue.enqueue c); c);
|
"Base.Queue", (fun n -> Obj.magic @@ let c = Base.Queue.create () in iter_range n (Base.Queue.enqueue c); c);
|
||||||
"Stdlib.Queue", (fun n -> Obj.magic @@ Queue.of_seq (OSeq.init ~n id));
|
"Stdlib.Queue", (fun n -> Obj.magic @@ (let q = Queue.create () in iter_range n (fun x -> Queue.push x q); q));
|
||||||
"CCQueue", (fun n -> Obj.magic @@ CCDeque.of_list (ns n));
|
"CCQueue", (fun n -> Obj.magic @@ CCDeque.of_list (ns n));
|
||||||
"Iter", (fun n -> Obj.magic @@ List.fold_right Iter.cons (ns n) Iter.empty);
|
"Iter", (fun n -> Obj.magic @@ List.fold_right Iter.cons (ns n) Iter.empty);
|
||||||
"Gen", (fun n -> Obj.magic @@ List.fold_right gen_cons (ns n) Gen.empty);
|
"Gen", (fun n -> Obj.magic @@ List.fold_right gen_cons (ns n) Gen.empty);
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,6 @@
|
||||||
open CCShims_
|
open CCShims_
|
||||||
|
|
||||||
type 'a or_error = ('a, string) result
|
type 'a or_error = ('a, string) result
|
||||||
type 'a iter = ('a -> unit) -> unit
|
|
||||||
type 'a gen = unit -> 'a option
|
type 'a gen = unit -> 'a option
|
||||||
|
|
||||||
module type SEXP = CCSexp_intf.SEXP
|
module type SEXP = CCSexp_intf.SEXP
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@ module type S = sig
|
||||||
end
|
end
|
||||||
|
|
||||||
(** Create a new bitfield type *)
|
(** Create a new bitfield type *)
|
||||||
module Make(X : sig end) : S
|
module Make : functor(_ : sig end) -> S
|
||||||
|
|
||||||
(**/**)
|
(**/**)
|
||||||
val all_bits_ : int -> int -> int
|
val all_bits_ : int -> int -> int
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue