Module

BenchLib

Package
purescript-benchlib
Repository
m-bock/purescript-benchlib

#Bench Source

newtype Bench a b

Opaque type for the benchmark.

Instances

#BenchOpts Source

type BenchOpts = { iterations :: Int }

Options for Benchmarks.

#BenchResult Source

type BenchResult = { benchName :: String, samples :: Array SampleResult }

The result of a benchmark.

#CheckResult Source

type CheckResult = { benchName :: String, showedInput :: Maybe String, showedOutput :: Maybe String }

#CheckResults Source

type CheckResults = { groupName :: String, results :: Array CheckResult, size :: Size, success :: Boolean }

#Group Source

newtype Group

Opaque type for the benchmark group.

Instances

#GroupOpts Source

type GroupOpts a b = { check :: Maybe (Size -> Array (a /\ b) -> Boolean), iterations :: Int, printInput :: Maybe (a -> String), printOutput :: Maybe (b -> String), sizes :: Array Int }

Options for the benchmark group.

#GroupResult Source

type GroupResult = { benchResults :: Array BenchResult, checkResults :: Maybe (Array CheckResults), groupName :: String }

The result of a benchmark group.

#Reporter Source

type Reporter = { onBenchFinish :: BenchResult -> Aff Unit, onBenchStart :: String -> Aff Unit, onGroupFinish :: GroupResult -> Aff Unit, onGroupStart :: String -> Aff Unit, onSampleFinish :: SampleResult -> Aff Unit, onSampleStart :: Size -> Aff Unit, onSuiteFinish :: SuiteResult -> Aff Unit, onSuiteStart :: String -> Aff Unit }

A reporter is a set of functions that are called at different stages of the benchmark. It allows to customize the output of the benchmark suite or perform other actions like writing to a file.

#RunOpts Source

type RunOpts = { reporters :: Array Reporter }

Options to run benchmark suites.

#SampleResult Source

type SampleResult = { average :: Milliseconds, iterations :: Int, size :: Size }

The result of one benchmark sample.

#Size Source

type Size = Int

#Suite Source

newtype Suite

Opaque type for the benchmark suite.

#SuiteOpts Source

type SuiteOpts = { iterations :: Int, sizes :: Array Size }

Options for the benchmark suite.

#SuiteResult Source

type SuiteResult = { groupResults :: Array GroupResult, suiteName :: String }

The result of a benchmark suite.

#basic Source

basic :: forall a b. Bench a b -> Bench Unit Unit

#bench Source

bench :: forall a b. String -> (BenchOpts -> BenchOpts) -> (Size -> a) -> (a -> b) -> Bench a b

#benchAff Source

benchAff :: forall a b. String -> (BenchOpts -> BenchOpts) -> (Size -> Aff a) -> (a -> Aff b) -> Bench a b

#benchAff_ Source

benchAff_ :: forall a b. String -> (Size -> Aff a) -> (a -> Aff b) -> Bench a b

Like benchAff, but with default options.

#bench_ Source

bench_ :: forall a b. String -> (Size -> a) -> (a -> b) -> Bench a b

#checkAllEq Source

checkAllEq :: forall a. Eq a => Array a -> Boolean

Check if all elements in the array are equal. Useful for checking the results of benchmarks.

#CanRunOnly Source

class CanRunOnly a  where

A combinator for entities that can be run only once. This is useful while debugging or developing benchmarks. So you do not have to run the whole suite again and again.

Members

Instances

#defaultReporter Source

defaultReporter :: Reporter

Default reporter useful for selective overriding. It will do nothing.

#group Source

group :: forall a b. String -> (GroupOpts a b -> GroupOpts a b) -> Array (Bench a b) -> Group

Create a benchmark group of a given name. The group will be run with the provided options. The group is a collection of benchmarks

#group_ Source

group_ :: forall a b. String -> Array (Bench a b) -> Group

Like group, but with default options.

#normalize Source

normalize :: forall a a' b b'. (a -> a') -> (b -> b') -> Bench a b -> Bench a' b'

#normalizeAff Source

normalizeAff :: forall a a' b b'. (a -> Aff a') -> (b -> Aff b') -> Bench a b -> Bench a' b'

#normalizeInput Source

normalizeInput :: forall a a' b. (a -> a') -> Bench a b -> Bench a' b

#normalizeInputAff Source

normalizeInputAff :: forall a a' b. (a -> Aff a') -> Bench a b -> Bench a' b

#normalizeOutput Source

normalizeOutput :: forall a b b'. (b -> b') -> Bench a b -> Bench a b'

#normalizeOutputAff Source

normalizeOutputAff :: forall a b b'. (b -> Aff b') -> Bench a b -> Bench a b'

#reportConsole Source

reportConsole :: Reporter

Console reporter. It will print the results to the console in human readable format.

#runNode Source

runNode :: (RunOpts -> RunOpts) -> Suite -> Effect Unit

Run the benchmark suite.

#suite Source

suite :: String -> (SuiteOpts -> SuiteOpts) -> Array Group -> Suite

Create a benchmark suite of a given name. The suite will be run with the provided options. The suite is a collection of groups, each containing multiple benchmarks.

#suite_ Source

suite_ :: String -> Array Group -> Suite

Like suite, but with default options.