Skip to content

Commit

Permalink
Revise benchmarks
Browse files Browse the repository at this point in the history
  • Loading branch information
polytypic committed Nov 10, 2024
1 parent 6c53ef1 commit 7b69532
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 25 deletions.
2 changes: 1 addition & 1 deletion bench/bench_dllist.ml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ let run_one ~budgetf ?(n_adders = 2) ?(n_takers = 2) ?(factor = 1)
if n <> 0 then begin
for _ = 1 to n do
while Option.is_none (Dllist.take_opt_l t) do
Domain.cpu_relax ()
Backoff.once Backoff.default |> ignore
done
done;
work ()
Expand Down
4 changes: 2 additions & 2 deletions bench/bench_mvar.ml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ let run_one ~budgetf ?(n_adders = 2) ?(blocking_add = false) ?(n_takers = 2)
if 0 < n then begin
for i = 1 to n do
while not (Mvar.try_put t i) do
Domain.cpu_relax ()
Backoff.once Backoff.default |> ignore
done
done;
work ()
Expand All @@ -54,7 +54,7 @@ let run_one ~budgetf ?(n_adders = 2) ?(blocking_add = false) ?(n_takers = 2)
if n <> 0 then begin
for _ = 1 to n do
while Option.is_none (Mvar.take_opt t) do
Domain.cpu_relax ()
Backoff.once Backoff.default |> ignore
done
done;
work ()
Expand Down
2 changes: 1 addition & 1 deletion bench/bench_queue.ml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ let run_one ~budgetf ?(n_adders = 2) ?(blocking_add = false) ?(n_takers = 2)
if n <> 0 then begin
for _ = 1 to n do
while Option.is_none (Queue.take_opt t) do
Domain.cpu_relax ()
Backoff.once Backoff.default |> ignore
done
done;
work ()
Expand Down
2 changes: 1 addition & 1 deletion bench/bench_stack.ml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ let run_one ~budgetf ?(n_adders = 2) ?(blocking_add = false) ?(n_takers = 2)
if n <> 0 then begin
for _ = 1 to n do
while Option.is_none (Stack.pop_opt t) do
Domain.cpu_relax ()
Backoff.once Backoff.default |> ignore
done
done;
work ()
Expand Down
30 changes: 12 additions & 18 deletions bench/dune
Original file line number Diff line number Diff line change
@@ -1,22 +1,16 @@
(* -*- tuareg -*- *)

let maybe_domain_shims_and_threads =
if Jbuild_plugin.V1.ocaml_version < "5" then "domain_shims threads.posix"
else ""

let () =
Jbuild_plugin.V1.send
@@ {|

(test
(name main)
(package kcas_data)
(action
(run %{test} -brief))
(libraries
kcas_data
multicore-bench
backoff
multicore-magic |}
^ maybe_domain_shims_and_threads ^ {| ))
|}
(progn
(run %{test} -brief "Kcas Loc")
(run %{test} -brief "Kcas Xt")
(run %{test} -brief "Kcas Xt read-only")
(run %{test} -brief "Kcas parallel CMP")
(run %{test} -brief "Kcas_data Accumulator")
(run %{test} -brief "Kcas_data Dllist")
(run %{test} -brief "Kcas_data Hashtbl")
(run %{test} -brief "Kcas_data Mvar")
(run %{test} -brief "Kcas_data Queue")
(run %{test} -brief "Kcas_data Stack")))
(libraries kcas_data multicore-bench backoff multicore-magic))
2 changes: 1 addition & 1 deletion dune-project
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
:with-test))
(multicore-bench
(and
(>= 0.1.5)
(>= 0.1.7)
:with-test))
(alcotest
(and
Expand Down
2 changes: 1 addition & 1 deletion kcas_data.opam
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ depends: [
"backoff" {>= "0.1.0" & with-test}
"domain-local-await" {>= "1.0.1" & with-test}
"domain_shims" {>= "0.1.0" & with-test}
"multicore-bench" {>= "0.1.5" & with-test}
"multicore-bench" {>= "0.1.7" & with-test}
"alcotest" {>= "1.8.0" & with-test}
"qcheck-core" {>= "0.21.2" & with-test}
"qcheck-stm" {>= "0.3" & with-test}
Expand Down

0 comments on commit 7b69532

Please sign in to comment.