Module

Benchmark.Suite.Monad

Package
purescript-benchmark
Repository
cyrbon/purescript-benchmark

#SuiteM Source

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

#SuiteT Source

newtype SuiteT s e a

Instances

#runSuiteT Source

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

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

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

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

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

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