mirror of
https://github.com/c-cube/moonpool.git
synced 2025-12-05 19:00:33 -05:00
bench fib: additional parameter
This commit is contained in:
parent
ab2d8d4956
commit
027d39e9a5
2 changed files with 6 additions and 2 deletions
3
Makefile
3
Makefile
|
|
@ -21,10 +21,11 @@ DUNE_OPTS_BENCH?=--profile=release
|
|||
N?=40
|
||||
NITER?=3
|
||||
BENCH_PSIZE?=1,4,8,20
|
||||
BENCH_CUTOFF?=20
|
||||
bench-fib:
|
||||
@echo running for N=$(N)
|
||||
dune build $(DUNE_OPTS_BENCH) benchs/fib_rec.exe
|
||||
hyperfine -L psize $(BENCH_PSIZE) \
|
||||
'./_build/default/benchs/fib_rec.exe -niter $(NITER) -psize={psize} -n $(N)'
|
||||
'./_build/default/benchs/fib_rec.exe -cutoff $(BENCH_CUTOFF) -niter $(NITER) -psize={psize} -n $(N)'
|
||||
|
||||
.PHONY: test clean
|
||||
|
|
|
|||
|
|
@ -6,8 +6,10 @@ let rec fib_direct x =
|
|||
else
|
||||
fib_direct (x - 1) + fib_direct (x - 2)
|
||||
|
||||
let cutoff = ref 20
|
||||
|
||||
let rec fib ~on x : int Fut.t =
|
||||
if x <= 20 then
|
||||
if x <= !cutoff then
|
||||
Fut.spawn ~on (fun () -> fib_direct x)
|
||||
else
|
||||
let open Fut.Infix_local in
|
||||
|
|
@ -42,6 +44,7 @@ let () =
|
|||
"-n", Arg.Set_int n, " fib <n>";
|
||||
"-seq", Arg.Set seq, " sequential";
|
||||
"-niter", Arg.Set_int niter, " number of iterations";
|
||||
"-cutoff", Arg.Set_int cutoff, " cutoff for sequential computation";
|
||||
]
|
||||
|> Arg.align
|
||||
in
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue