Benchmark
- Package
- purescript-benchmark
- Repository
- cyrbon/purescript-benchmark
#runBench Source
runBench :: forall a e s. SuiteT s (st :: ST s | e) a -> Eff (st :: ST s | e) Unit
Runs the benchmark suite and print results. Use fn
and fnEff
inside the
monadic interface to add functions to the suite.
runBench $ do fn "function name" (_ + 40) 2 fnEff "eff function name" (log "eff function executed")
Re-exports from Benchmark.Function
Re-exports from Benchmark.Output
#printResultTableOnComplete Source
printResultTableOnComplete :: forall m e s. SuiteM s e m (m Unit)
Accumulate benchmark results on each cycle, and onComplete print a table containing all results.
#printResultOnCycle Source
printResultOnCycle :: forall m e s. SuiteM s e m (m Unit)
Subscribes to Suite's on("cycle"
event and outputs String(event.target)
to console.
Re-exports from Benchmark.Suite
Re-exports from Benchmark.Suite.Monad
#runSuiteM Source
runSuiteM :: forall a e s. SuiteT s (st :: ST s | e) a -> Eff (st :: ST s | e) Unit
Runs SuiteM transformer stack. This is equal to executing suite.run()
,
where suite is constructed via the monad interface:
runSuiteM $ do add "functionOne" myFunction add "functionTwo" myFunctionTwo
The code above will construct a suite with two functions to benchmark and run those benchmarks.
#run Source
run :: forall e m s. SuiteM s e m (m Unit)
Runs the suite. This can be used inside SuiteM. Most often, you want to use
runSuiteM
instead, because SuiteM is usually used to construct the suite
and then once the suite is constructed it's run using runSuiteM
. Using
run
will run the suite during the construction process.
#on Source
on :: forall anyEff e m s. SuiteM s e m (BenchmarkEventName -> (BenchmarkEvent -> Eff anyEff Unit) -> m Unit)
Registers a listener for the specified event type(s).
#accumulateResults Source
accumulateResults :: forall anyEff e m s. SuiteM s e m ((Array BenchmarkResult -> Eff anyEff Unit) -> m Unit)
Accumulates results of each cycle in an array. onComplete
calls the
provided callback with the array containing accumulated results.