Module
Performance.Minibench
- Package
- purescript-minibench
- Repository
- paf31/purescript-minibench
This module provides the bench
function, which prints a short summary
of the running times of a synchronous function to the console.
For benchmarking tasks which require finer accuracy, or graphs as output,
consider using purescript-benchotron
instead.
#benchWith Source
benchWith :: forall a eff. Int -> (Unit -> a) -> Eff (console :: CONSOLE | eff) Unit
Estimate the running time of a function and print a summary to the console, specifying the number of samples to take. More samples will give a better estimate of both mean and standard deviation, but will increase running time.
#bench Source
bench :: forall a eff. (Unit -> a) -> Eff (console :: CONSOLE | eff) Unit
Estimate the running time of a function and print a summary to the console, by running the function 1000 times.
For example:
> import Data.Array
> import Data.Foldable
> import Performance.Minibench
> bench \_ -> sum (1 .. 10000)
mean = 414.00 μs
stddev = 494.82 μs
- Modules
- Performance.
Minibench