Module

BenchLib

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

#Size Source

type Size = Int

#Bench Source

newtype Bench a b

Opaque type for the benchmark.

Instances

#Group Source

newtype Group

Opaque type for the benchmark group.

Instances

#Suite Source

newtype Suite

Opaque type for the benchmark suite.

#BenchResult Source

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

The result of a benchmark.

#GroupResult Source

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

The result of a benchmark group.

#SuiteResult Source

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

The result of a benchmark suite.

#SampleResult Source

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

The result of one benchmark sample.

#CheckResults Source

type CheckResults = { groupName :: String, results :: Array { benchName :: String, showedVal :: Maybe String }, size :: Size, success :: Boolean }

#RunOpts Source

type RunOpts = { reporters :: Array Reporter }

Options to run benchmark suites.

#SuiteOpts Source

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

Options for the benchmark suite.

#GroupOpts Source

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

Options for the benchmark group.

#BenchOpts Source

type BenchOpts = { iterations :: Int }

Options for Benchmarks.

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

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

#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

#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

#suite_ Source

suite_ :: String -> Array Group -> Suite

Like suite, but with default options.

#group_ Source

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

Like group, but with default options.

#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

#basic Source

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

#normalizeAff Source

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

#normalize Source

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

#normalizeInputAff Source

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

#normalizeOutputAff Source

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

#normalizeInput Source

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

#normalizeOutput Source

normalizeOutput :: forall a b b'. (b -> b') -> Bench 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.

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