File tree Expand file tree Collapse file tree 15 files changed +32
-34
lines changed Expand file tree Collapse file tree 15 files changed +32
-34
lines changed Original file line number Diff line number Diff line change @@ -15,13 +15,13 @@ let duplicate kind name x _ =
15
15
(name x |> replace_non_breaking_spaces))
16
16
17
17
let print_diff base next =
18
- List . zip_by
18
+ List_ext . zip_by
19
19
~duplicate: (duplicate " benchmark" Benchmark. name)
20
20
String. compare Benchmark. name base next
21
21
|> List. iter @@ fun ((base : Benchmark.t ), (next : Benchmark.t )) ->
22
22
Printf. printf " %s:\n " base.name;
23
23
let zipped =
24
- List . zip_by
24
+ List_ext . zip_by
25
25
~duplicate: (duplicate " metric" Metric. name)
26
26
String. compare Metric. name base.metrics next.metrics
27
27
in
@@ -159,7 +159,7 @@ let run ~benchmarks ?(budgetf = 0.025) ?(filters = []) ?(debug = false)
159
159
match base_results with
160
160
| [] -> Fun. id
161
161
| results ->
162
- let (module S ) = Set . make String. compare in
162
+ let (module S ) = Set_ext . make String. compare in
163
163
let names = results |> List. map Benchmark. name |> S. of_list in
164
164
List. filter (fun (name , _ ) -> S. mem name names)
165
165
end
Original file line number Diff line number Diff line change @@ -38,23 +38,23 @@ let non_atomic_set t count =
38
38
39
39
let rec get t count i =
40
40
if i < Array. length t && Array. unsafe_get t i != Array. unsafe_get t 0 then
41
- get t (count + Int . max 0 (Atomic. get (Array. unsafe_get t i))) (i + 1 )
41
+ get t (count + Int_ext . max 0 (Atomic. get (Array. unsafe_get t i))) (i + 1 )
42
42
else count
43
43
44
- let [@ inline] get t = get t (Int . max 0 (Atomic. get (Array. unsafe_get t 0 ))) 1
44
+ let [@ inline] get t = get t (Int_ext . max 0 (Atomic. get (Array. unsafe_get t 0 ))) 1
45
45
46
46
let rec alloc t ~batch i =
47
47
if i < Array. length t then
48
48
let c = Array. unsafe_get t i in
49
49
if 0 < Atomic. get c then
50
50
let n = Atomic. fetch_and_add c (- batch) in
51
- if 0 < n then Int . min n batch else alloc t ~batch (i + 1 )
51
+ if 0 < n then Int_ext . min n batch else alloc t ~batch (i + 1 )
52
52
else alloc t ~batch (i + 1 )
53
53
else 0
54
54
55
55
let [@ inline] alloc t ~domain_index ~batch =
56
56
let c = Array. unsafe_get t domain_index in
57
57
if 0 < Atomic. get c then
58
58
let n = Atomic. fetch_and_add c (- batch) in
59
- if 0 < n then Int . min n batch else alloc t ~batch 0
59
+ if 0 < n then Int_ext . min n batch else alloc t ~batch 0
60
60
else alloc t ~batch 0
Original file line number Diff line number Diff line change 1
- open Option .Syntax
1
+ open Option_ext .Syntax
2
2
3
3
module Trend = struct
4
4
type t = [ `Lower_is_better | `Higher_is_better ]
Original file line number Diff line number Diff line change @@ -11,7 +11,13 @@ let () =
11
11
(enabled_if
12
12
(< %{ocaml_version} 4.13.0))
13
13
(action
14
- (copy int.ocaml_4_12.ml int.ml)))
14
+ (copy int_ext.ocaml_lt_4_13.ml int_ext.ml)))
15
+
16
+ (rule
17
+ (enabled_if
18
+ (>= %{ocaml_version} 4.13.0))
19
+ (action
20
+ (copy int_ext.ocaml_ge_4_13.ml int_ext.ml)))
15
21
16
22
(library
17
23
(public_name multicore-bench)
Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ let min = Int. min
2
+ let max = Int. max
Original file line number Diff line number Diff line change
1
+ let min (x : int ) (y : int ) = if x < y then x else y
2
+ let max (x : int ) (y : int ) = if x < y then y else x
Original file line number Diff line number Diff line change 1
- open Option .Syntax
1
+ open Option_ext .Syntax
2
2
3
3
type t = Yojson.Safe.t
4
4
Original file line number Diff line number Diff line change 1
- include Stdlib. List
2
-
3
1
let default_duplicate _ _ = invalid_arg " duplicate key"
4
2
let default_missing _ _ = None
5
3
6
4
let zip_by (type k ) ?(duplicate = default_duplicate)
7
5
?(missing = default_missing) (compare : k -> _ ) key_of xs ys =
8
- let (module M ) = Map . make compare in
6
+ let (module M ) = Map_ext . make compare in
9
7
let to_map xs =
10
8
xs
11
- |> fold_left
9
+ |> List. fold_left
12
10
(fun m x ->
13
11
m
14
12
|> M. update (key_of x) @@ function
@@ -24,4 +22,4 @@ let zip_by (type k) ?(duplicate = default_duplicate)
24
22
| None , Some y -> missing `L y
25
23
| None , None -> None )
26
24
(to_map xs) (to_map ys)
27
- |> M. bindings |> map snd
25
+ |> M. bindings |> List. map snd
Original file line number Diff line number Diff line change 1
- include Stdlib. Set
2
-
3
1
let make (type t ) (compare : t -> _ ) =
4
2
let (module Elt ) = Ordered. make compare in
5
- (module Make (Elt ) : Stdlib.Set. S with type elt = t)
3
+ (module Map. Make (Elt ) : Map. S with type key = t)
You can’t perform that action at this time.
0 commit comments