actorMain is BenchmarkListnewcreate(env: Env) =>
PonyBench(env, this)
funtagbenchmarks(bench: PonyBench) =>
bench(Fib(5))
bench(Fib(10))
bench(Fib(20))
bench(Fib(40))
classisoFib is MicroBenchmarklet _n: U64newisocreate(n: U64) =>
_n = n
funname(): String =>
"Fib(" + _n.string() + ")"funapply() =>
DoNotOptimise[U64](_fib(_n))
DoNotOptimise.observe()
fun_fib(n: U64): U64 =>
if n < 2then1else_fib(n - 1) + _fib(n - 2)
end
Output
$ ponyc -V0 --runtimebc examples/simple -b simple && ./simple --ponynoyield
Benchmark results will have their mean and median adjusted for overhead.
You may disable this with --noadjust.
Benchmark mean median deviation iterations
Fib(5) 15 ns 16 ns ±0.11% 1000000
Fib(10) 180 ns 180 ns ±0.55% 500000
Fib(20) 21525 ns 21511 ns ±0.30% 10000
Fib(40) 324952472 ns 324871552 ns ±0.21% 1