File tree Expand file tree Collapse file tree 7 files changed +20
-15
lines changed Expand file tree Collapse file tree 7 files changed +20
-15
lines changed Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ module Make (Bounded_queue : Bounded_queue_intf.BOUNDED_QUEUE) : BENCH = struct
9
9
let t = Bounded_queue. create () in
10
10
11
11
let op push =
12
- if push then Bounded_queue. try_push t 101 |> ignore
12
+ if push then Bounded_queue. try_push t ( ref push) |> ignore
13
13
else Bounded_queue. pop_opt t |> ignore
14
14
in
15
15
@@ -43,7 +43,7 @@ module Make (Bounded_queue : Bounded_queue_intf.BOUNDED_QUEUE) : BENCH = struct
43
43
let n = Util. alloc n_msgs_to_add in
44
44
if 0 < n then begin
45
45
for i = 1 to n do
46
- Bounded_queue. try_push t i |> ignore
46
+ Bounded_queue. try_push t ( ref i) |> ignore
47
47
done ;
48
48
work ()
49
49
end
Original file line number Diff line number Diff line change @@ -5,7 +5,8 @@ let run_one_domain ~budgetf ?(n_msgs = 50 * Util.iter_factor) () =
5
5
let t = Stack. create () in
6
6
7
7
let op push =
8
- if push then Stack. try_push t 101 |> ignore else Stack. pop_opt t |> ignore
8
+ if push then Stack. try_push t (ref push) |> ignore
9
+ else Stack. pop_opt t |> ignore
9
10
in
10
11
11
12
let init _ =
@@ -37,7 +38,7 @@ let run_one ~budgetf ?(n_adders = 2) ?(n_takers = 2)
37
38
let n = Util. alloc n_msgs_to_add in
38
39
if 0 < n then begin
39
40
for i = 1 to n do
40
- Stack. try_push t i |> ignore
41
+ Stack. try_push t ( ref i) |> ignore
41
42
done ;
42
43
work ()
43
44
end
Original file line number Diff line number Diff line change @@ -4,7 +4,9 @@ module Queue = Saturn.Single_consumer_queue
4
4
let run_one_domain ~budgetf ?(n_msgs = 50 * Util. iter_factor) () =
5
5
let t = Queue. create () in
6
6
7
- let op push = if push then Queue. push t 101 else Queue. pop_opt t |> ignore in
7
+ let op push =
8
+ if push then Queue. push t (ref push) else Queue. pop_opt t |> ignore
9
+ in
8
10
9
11
let init _ =
10
12
assert (Queue. is_empty t);
@@ -35,7 +37,7 @@ let run_one ~budgetf ?(n_adders = 2) ?(n_takers = 2)
35
37
let n = Util. alloc n_msgs_to_add in
36
38
if 0 < n then begin
37
39
for i = 1 to n do
38
- Queue. push t i
40
+ Queue. push t ( ref i)
39
41
done ;
40
42
work ()
41
43
end
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ module Make (Queue : Michael_scott_queue_intf.MS_QUEUE) : BENCH = struct
9
9
let t = Queue. create () in
10
10
11
11
let op push =
12
- if push then Queue. push t 101 else Queue. pop_opt t |> ignore
12
+ if push then Queue. push t ( ref push) else Queue. pop_opt t |> ignore
13
13
in
14
14
15
15
let init _ =
@@ -42,7 +42,7 @@ module Make (Queue : Michael_scott_queue_intf.MS_QUEUE) : BENCH = struct
42
42
let n = Util. alloc n_msgs_to_add in
43
43
if 0 < n then begin
44
44
for i = 1 to n do
45
- Queue. push t i
45
+ Queue. push t ( ref i)
46
46
done ;
47
47
work ()
48
48
end
Original file line number Diff line number Diff line change @@ -17,14 +17,14 @@ module Make (Queue : Spsc_queue_intf.SPSC_queue) : BENCH = struct
17
17
done ;
18
18
let n = Random. int ((1 lsl size_exponent) + 1 ) in
19
19
for i = 1 to n do
20
- Queue. push_exn t i
20
+ Queue. push_exn t ( ref i)
21
21
done
22
22
in
23
23
let work i () =
24
24
if i = 0 then
25
25
let rec loop n =
26
26
if 0 < n then
27
- if Queue. try_push t n then loop (n - 1 )
27
+ if Queue. try_push t ( ref n) then loop (n - 1 )
28
28
else begin
29
29
Domain. cpu_relax () ;
30
30
loop n
Original file line number Diff line number Diff line change @@ -4,7 +4,9 @@ module Stack = Saturn.Stack
4
4
let run_one_domain ~budgetf ?(n_msgs = 50 * Util. iter_factor) () =
5
5
let t = Stack. create () in
6
6
7
- let op push = if push then Stack. push t 101 else Stack. pop_opt t |> ignore in
7
+ let op push =
8
+ if push then Stack. push t (ref push) else Stack. pop_opt t |> ignore
9
+ in
8
10
9
11
let init _ =
10
12
assert (Stack. is_empty t);
@@ -35,7 +37,7 @@ let run_one ~budgetf ?(n_adders = 2) ?(n_takers = 2)
35
37
let n = Util. alloc n_msgs_to_add in
36
38
if 0 < n then begin
37
39
for i = 1 to n do
38
- Stack. push t i
40
+ Stack. push t ( ref i)
39
41
done ;
40
42
work ()
41
43
end
Original file line number Diff line number Diff line change @@ -89,11 +89,11 @@ let run_as_one_domain ~budgetf ?(n_msgs = 150 * Util.iter_factor) order =
89
89
let t = Ws_deque. create () in
90
90
91
91
let op_lifo push =
92
- if push then Ws_deque. push t 101
92
+ if push then Ws_deque. push t ( ref push)
93
93
else
94
94
match Ws_deque. pop_exn t with _ -> () | exception Ws_deque. Empty -> ()
95
95
and op_fifo push =
96
- if push then Ws_deque. push t 101
96
+ if push then Ws_deque. push t ( ref push)
97
97
else
98
98
match Ws_deque. steal_exn t with _ -> () | exception Ws_deque. Empty -> ()
99
99
in
@@ -151,7 +151,7 @@ let run_as_spmc ~budgetf ~n_thiefs () =
151
151
work ()
152
152
else
153
153
for i = 1 to n_msgs do
154
- Ws_deque. push t i
154
+ Ws_deque. push t ( ref i)
155
155
done
156
156
in
157
157
You can’t perform that action at this time.
0 commit comments