BenchmarkIps
Summary
bench(fun, batches, target_duration_s) | Returns the number of iterations and elapsed time of running a function in batches for the provided target duration (seconds) |
call_times(fun, times) | Calls the function the specified number of times |
iterations_per_100ms(iters, time_us) | Returns the number of iterations that should be able to be run in 100ms given a number of iterations and a duration in microseconds |
iterations_runnable_in_duration_by_batches(fun, batches, target_duration_us) | Returns the number of iterations a function can run in the provided duration (microseconds) by running it in batches and checking between batches on the time elapsed |
iterations_runnable_in_duration_by_batches(fun, batches, target_end_time_us, iters) | |
measure_in_us(fun) | Returns the result of running a function and the time it took to run in microseconds |
now_us() | Returns current time in microseconds |
report(fun, options \\ []) | Benchmarks a function and returns the iterations per second and microseconds per iterations |
Functions
Specs:
- bench(zero_arity_fun, pos_integer, number) :: {pos_integer, number}
Returns the number of iterations and elapsed time of running a function in batches for the provided target duration (seconds)
Specs:
- call_times(zero_arity_fun, pos_integer) :: nil
Calls the function the specified number of times
Specs:
- iterations_per_100ms(pos_integer, number) :: pos_integer
Returns the number of iterations that should be able to be run in 100ms given a number of iterations and a duration in microseconds
Specs:
- iterations_runnable_in_duration_by_batches(zero_arity_fun, pos_integer, number) :: pos_integer
Returns the number of iterations a function can run in the provided duration (microseconds) by running it in batches and checking between batches on the time elapsed
Specs:
- measure_in_us(zero_arity_fun) :: {any, number}
Returns the result of running a function and the time it took to run in microseconds
Specs:
- now_us :: pos_integer
Returns current time in microseconds
Specs:
- report(zero_arity_fun, warmup_duration_s: number, bench_duration_s: number) :: {float, float}
Benchmarks a function and returns the iterations per second and microseconds per iterations
The function is first benchmarked for the provided warmup duration (seconds, default 1) in batches of 1 in order to determine about how many iterations can run in 100ms.
It is then benchmarked in batches of that number of iterations for the provided bench duration (seconds, default 2).