Module

Benchotron.Core

Package
purescript-benchotron
Repository
hdgarrood/purescript-benchotron

#Benchmark Source

newtype Benchmark

#BenchmarkF Source

type BenchmarkF a = { functions :: Array (BenchmarkFunction a), gen :: Int -> Gen a, inputsPerSize :: Int, sizeInterpretation :: String, sizes :: Array Int, slug :: String, title :: String }

A value representing a benchmark to be performed. The type parameter is the type of the input to each of the competing functions in the benchmark.

Attributes

  • slug: An identifier for the benchmark. Used for filenames.
  • title: The title of the benchmark.
  • sizes: An array of numbers representing each input size you would like your benchmark to be run with. The interpretation of 'size' depends on the specific case; if the input is an array, for example, the size would usually be the number of elements in the array.
  • sizeInterpretation: A String with a human-readable description of how the size is meant to be interpreted in this specific case.
  • inputsPerSize: The number of inputs to be generated for each each input size. Often it's acceptable to set this to 1. By using higher values, you can have more confidence in your results; however, your benchmarks will also take much longer to run.
  • gen: a QuickCheck generator, which should produce a random input of the given argument size when executed.
  • functions: An array of competing functions to be benchmarked.

#BenchmarkFunction Source

#mkBenchmark Source

mkBenchmark :: forall a. BenchmarkF a -> Benchmark

#unpackBenchmark Source

unpackBenchmark :: forall r. (forall a. BenchmarkF a -> r) -> Benchmark -> r

#benchFn Source

benchFn :: forall r a. String -> (a -> r) -> BenchmarkFunction a

Create a BenchmarkFunction, given a name and a function to be benchmarked.

#benchFn' Source

benchFn' :: forall r b a. String -> (b -> r) -> (a -> b) -> BenchmarkFunction a

Create a BenchmarkFunction. Like benchFn, except that it accepts a third argument which will be used to preprocess the input, before starting the benchmark. This is useful if you want to compare two functions which have different argument types.

#runBenchmarkF Source

#runBenchM Source

runBenchM :: forall a. BenchM a -> GenState -> Effect a

#BenchmarkResult Source

type BenchmarkResult = { series :: Array ResultSeries, sizeInterpretation :: String, slug :: String, title :: String }

#ResultSeries Source

type ResultSeries = { name :: String, results :: Array DataPoint }

#DataPoint Source

type DataPoint = { size :: Int, stats :: Stats }