Module

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")

#fnEff Source

fnEff :: forall a anyEff e m s. SuiteM s e m (String -> Eff anyEff a -> m Unit)

#fn Source

fn :: forall b a e m s. SuiteM s e m (String -> (a -> b) -> a -> m Unit)

Re-exports from Benchmark.Function

#fn1 Source

fn1 :: forall e b a. (a -> b) -> a -> Eff e Unit

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

#Suite Source

data Suite :: Type

Re-exports from Benchmark.Suite.Monad

#SuiteT Source

newtype SuiteT s e a

Instances

#SuiteM Source

type SuiteM s e m a = MonadReader (STSuite s) m => MonadEff (st :: ST s | e) m => a

#runSuiteT Source

runSuiteT :: forall a e s. SuiteT s (st :: ST s | e) a -> Suite

#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).

#add Source

add :: forall a anyEff e m s. SuiteM s e m (String -> Eff anyEff a -> m Unit)

Adds a test to the benchmark suite. Takes a name to identify the benchmark, and the test to benchmark.

#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.

Re-exports from Benchmark.Suite.ST

#BenchmarkResult Source

type BenchmarkResult = { hz :: Number, name :: String, stats :: { rme :: Number } }