Module
Benchotron.Core
- Package
- purescript-benchotron
- Repository
- hdgarrood/purescript-benchotron
#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
: AString
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
newtype BenchmarkFunction a
#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.
#runBenchmark Source
runBenchmark :: Benchmark -> (Int -> Int -> BenchM Unit) -> BenchM BenchmarkResult
#runBenchmarkF Source
runBenchmarkF :: forall a. BenchmarkF a -> (Int -> Int -> BenchM Unit) -> BenchM BenchmarkResult
#BenchmarkResult Source
type BenchmarkResult = { series :: Array ResultSeries, sizeInterpretation :: String, slug :: String, title :: String }