criterion-1.5.5.0: Robust, reliable performance measurement and analysis

Copyright | (c) 2009-2014 Bryan O'Sullivan
License | BSD-style
Maintainer | bos@serpentine.com
Stability | experimental
Portability | GHC
Safe Haskell | Trustworthy
Language | Haskell2010

Criterion.Types

Contents

- Configuration
- Benchmark descriptions
- Measurements
- Benchmark construction
  - Evaluation control
- Result types

Description

Types for benchmarking.

The core type is `Benchmarkable`, which admits both pure functions and `IO` actions.

For a pure function of type `a -> b`, the benchmarking harness calls this function repeatedly, each time with a different `Int64` argument (the number of times to run the function in a loop), and reduces the result the function returns to weak head normal form.

For an action of type `IO a`, the benchmarking harness calls the action repeatedly, but does not reduce the result.

Synopsis

- data Config = Config {
  - confInterval :: CL Double
  - timeLimit :: Double
  - resamples :: Int
  - regressions :: [([String], String)]
  - rawDataFile :: Maybe FilePath
  - reportFile :: Maybe FilePath
  - csvFile :: Maybe FilePath
  - jsonFile :: Maybe FilePath
  - junitFile :: Maybe FilePath
  - verbosity :: Verbosity
  - template :: FilePath
  }
- data Verbosity
  - = Quiet
  - | Normal
  - | Verbose
- data Benchmarkable where
  - Benchmarkable :: forall a. NFData a => {..} -> Benchmarkable
- data Benchmark where
  - Environment :: forall env a. NFData env => IO env -> (env -> IO a) -> (env -> Benchmark) -> Benchmark
  - Benchmark :: forall. String -> Benchmarkable -> Benchmark
  - BenchGroup :: forall. String -> [Benchmark] -> Benchmark
- data Measured = Measured {
  - measTime :: !Double
  - measCpuTime :: !Double
  - measCycles :: !Int64
  - measIters :: !Int64
  - measAllocated :: !Int64
  - measNumGcs :: !Int64
  - measBytesCopied :: !Int64
  - measMutatorWallSeconds :: !Double
  - measMutatorCpuSeconds :: !Double
  - measGcWallSeconds :: !Double
  - measGcCpuSeconds :: !Double
  }
- fromInt :: Int64 -> Maybe Int64
- toInt :: Maybe Int64 -> Int64
- fromDouble :: Double -> Maybe Double
- toDouble :: Maybe Double -> Double
- measureAccessors :: Map String (Measured -> Maybe Double, String)
- measureKeys :: [String]
- measure :: Unbox a => (Measured -> a) -> Vector Measured -> Vector a
- rescale :: Measured -> Measured
- env :: NFData env => IO env -> (env -> Benchmark) -> Benchmark
- envWithCleanup :: NFData env => IO env -> (env -> IO a) -> (env -> Benchmark) -> Benchmark
- perBatchEnv :: (NFData env, NFData b) => (Int64 -> IO env) -> (env -> IO b) -> Benchmarkable
- perBatchEnvWithCleanup :: (NFData env, NFData b) => (Int64 -> IO env) -> (Int64 -> env -> IO ()) -> (env -> IO b) -> Benchmarkable
- perRunEnv :: (NFData env, NFData b) => IO env -> (env -> IO b) -> Benchmarkable
- perRunEnvWithCleanup :: (NFData env, NFData b) => IO env -> (env -> IO ()) -> (env -> IO b) -> Benchmarkable
- toBenchmarkable :: (Int64 -> IO ()) -> Benchmarkable
- bench :: String -> Benchmarkable -> Benchmark
- bgroup :: String -> [Benchmark] -> Benchmark
- addPrefix :: String -> String -> String
- benchNames :: Benchmark -> [String]
- nf :: NFData b => (a -> b) -> a -> Benchmarkable
- whnf :: (a -> b) -> a -> Benchmarkable
- nfIO :: NFData a => IO a -> Benchmarkable
- whnfIO :: IO a -> Benchmarkable
- nfAppIO :: NFData b => (a -> IO b) -> a -> Benchmarkable
- whnfAppIO :: (a -> IO b) -> a -> Benchmarkable
- data Outliers = Outliers {
  - samplesSeen :: !Int64
  - lowSevere :: !Int64
  - lowMild :: !Int64
  - highMild :: !Int64
  - highSevere :: !Int64
  }
- data OutlierEffect
  - = Unaffected
  - | Slight
  - | Moderate
  - | Severe
- data OutlierVariance = OutlierVariance {
  - ovEffect :: OutlierEffect
  - ovDesc :: String
  - ovFraction :: Double
  }
- data Regression = Regression {
  - regResponder :: String
  - regCoeffs :: Map String (Estimate ConfInt Double)
  - regRSquare :: Estimate ConfInt Double
  }
- data KDE = KDE {
  - kdeType :: String
  - kdeValues :: Vector Double
  - kdePDF :: Vector Double
  }
- data Report = Report {
  - reportNumber :: Int
  - reportName :: String
  - reportKeys :: [String]
  - reportMeasured :: Vector Measured
  - reportAnalysis :: SampleAnalysis
  - reportOutliers :: Outliers
  - reportKDEs :: [KDE]
  }
- data SampleAnalysis = SampleAnalysis {
  - anRegress :: [Regression]
  - anMean :: Estimate ConfInt Double
  - anStdDev :: Estimate ConfInt Double
  - anOutlierVar :: OutlierVariance
  }
- data DataRecord
  - = Measurement Int String (Vector Measured)
  - | Analysed Report

# Configuration

data Config Source #

Top-level benchmarking configuration.

Constructors

Config |

Fields

- confInterval :: CL Double

  Confidence interval for bootstrap estimation (greater than 0, less than 1).

- timeLimit :: Double

  Number of seconds to run a single benchmark. (In practice, execution time will very slightly exceed this limit.)

- resamples :: Int

  Number of resamples to perform when bootstrapping.

- regressions :: [([String], String)]

  Regressions to perform.

- rawDataFile :: Maybe FilePath

  File to write binary measurement and analysis data to. If not specified, this will be a temporary file.

- reportFile :: Maybe FilePath

  File to write report output to, with template expanded.

- csvFile :: Maybe FilePath

  File to write CSV summary to.

- jsonFile :: Maybe FilePath

  File to write JSON-formatted results to.

- junitFile :: Maybe FilePath

  File to write JUnit-compatible XML results to.

- verbosity :: Verbosity

  Verbosity level to use when running and analysing benchmarks.

- template :: FilePath

  Template file to use if writing a report.

Instances

Eq Config Source # |
Instance details Defined in Criterion.Types Methods (==) :: Config -> Config -> Bool Source # (/=) :: Config -> Config -> Bool Source #
Data Config Source # |

Instance details

Defined in Criterion.Types

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Config -> c Config Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Config Source #

toConstr :: Config -> Constr Source #

dataTypeOf :: Config -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Config) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Config) Source #

gmapT :: (forall b. Data b => b -> b) -> Config -> Config Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Config -> r Source #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Config -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> Config -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Config -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Config -> m Config Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Config -> m Config Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Config -> m Config Source #

Read Config Source # |
Instance details Defined in Criterion.Types Methods readsPrec :: Int -> ReadS Config Source # readList :: ReadS [Config] Source # readPrec :: ReadPrec Config Source # readListPrec :: ReadPrec [Config] Source #
Show Config Source # |
Instance details Defined in Criterion.Types Methods showsPrec :: Int -> Config -> ShowS Source # show :: Config -> String Source # showList :: [Config] -> ShowS Source #
Generic Config Source # |
Instance details Defined in Criterion.Types Associated Types type Rep Config :: Type -> Type Source # Methods from :: Config -> Rep Config x Source # to :: Rep Config x -> Config Source #
MonadReader Config Criterion Source # |
Instance details Defined in Criterion.Monad.Internal Methods ask :: Criterion Config Source # local :: (Config -> Config) -> Criterion a -> Criterion a Source # reader :: (Config -> a) -> Criterion a Source #
type Rep Config Source # |

Instance details

Defined in Criterion.Types

type Rep Config = D1 (MetaData "Config" "Criterion.Types" "criterion-1.5.5.0-JhSXImw0TG1I5gwSxjGZK3" False) (C1 (MetaCons "Config" PrefixI True) (((S1 (MetaSel (Just "confInterval") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (CL Double)) :*: S1 (MetaSel (Just "timeLimit") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Double)) :*: (S1 (MetaSel (Just "resamples") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Int) :*: (S1 (MetaSel (Just "regressions") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [([String], String)]) :*: S1 (MetaSel (Just "rawDataFile") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Maybe FilePath))))) :*: ((S1 (MetaSel (Just "reportFile") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Maybe FilePath)) :*: (S1 (MetaSel (Just "csvFile") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Maybe FilePath)) :*: S1 (MetaSel (Just "jsonFile") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Maybe FilePath)))) :*: (S1 (MetaSel (Just "junitFile") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Maybe FilePath)) :*: (S1 (MetaSel (Just "verbosity") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Verbosity) :*: S1 (MetaSel (Just "template") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 FilePath))))))

data Verbosity Source #

Control the amount of information displayed.

Constructors

Quiet |
Normal |
Verbose |

Instances

Bounded Verbosity Source # |
Instance details Defined in Criterion.Types Methods minBound :: Verbosity Source # maxBound :: Verbosity Source #
Enum Verbosity Source # |

Instance details

Defined in Criterion.Types

Methods

succ :: Verbosity -> Verbosity Source #

pred :: Verbosity -> Verbosity Source #

toEnum :: Int -> Verbosity Source #

fromEnum :: Verbosity -> Int Source #

enumFrom :: Verbosity -> [Verbosity] Source #

enumFromThen :: Verbosity -> Verbosity -> [Verbosity] Source #

enumFromTo :: Verbosity -> Verbosity -> [Verbosity] Source #

enumFromThenTo :: Verbosity -> Verbosity -> Verbosity -> [Verbosity] Source #

Eq Verbosity Source # |
Instance details Defined in Criterion.Types Methods (==) :: Verbosity -> Verbosity -> Bool Source # (/=) :: Verbosity -> Verbosity -> Bool Source #
Data Verbosity Source # |

Instance details

Defined in Criterion.Types

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Verbosity -> c Verbosity Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Verbosity Source #

toConstr :: Verbosity -> Constr Source #

dataTypeOf :: Verbosity -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Verbosity) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Verbosity) Source #

gmapT :: (forall b. Data b => b -> b) -> Verbosity -> Verbosity Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Verbosity -> r Source #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Verbosity -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> Verbosity -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Verbosity -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Verbosity -> m Verbosity Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Verbosity -> m Verbosity Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Verbosity -> m Verbosity Source #

Ord Verbosity Source # |
Instance details Defined in Criterion.Types Methods compare :: Verbosity -> Verbosity -> Ordering Source # (<) :: Verbosity -> Verbosity -> Bool Source # (<=) :: Verbosity -> Verbosity -> Bool Source # (>) :: Verbosity -> Verbosity -> Bool Source # (>=) :: Verbosity -> Verbosity -> Bool Source # max :: Verbosity -> Verbosity -> Verbosity Source # min :: Verbosity -> Verbosity -> Verbosity Source #
Read Verbosity Source # |
Instance details Defined in Criterion.Types Methods readsPrec :: Int -> ReadS Verbosity Source # readList :: ReadS [Verbosity] Source # readPrec :: ReadPrec Verbosity Source # readListPrec :: ReadPrec [Verbosity] Source #
Show Verbosity Source # |
Instance details Defined in Criterion.Types Methods showsPrec :: Int -> Verbosity -> ShowS Source # show :: Verbosity -> String Source # showList :: [Verbosity] -> ShowS Source #
Generic Verbosity Source # |
Instance details Defined in Criterion.Types Associated Types type Rep Verbosity :: Type -> Type Source # Methods from :: Verbosity -> Rep Verbosity x Source # to :: Rep Verbosity x -> Verbosity Source #
type Rep Verbosity Source # |
Instance details Defined in Criterion.Types type Rep Verbosity = D1 (MetaData "Verbosity" "Criterion.Types" "criterion-1.5.5.0-JhSXImw0TG1I5gwSxjGZK3" False) (C1 (MetaCons "Quiet" PrefixI False) (U1 :: Type -> Type) :+: (C1 (MetaCons "Normal" PrefixI False) (U1 :: Type -> Type) :+: C1 (MetaCons "Verbose" PrefixI False) (U1 :: Type -> Type)))

# Benchmark descriptions

data Benchmarkable where Source #

A pure function or impure action that can be benchmarked. The `Int64` parameter indicates the number of times to run the given function or action.

Constructors

Benchmarkable |

Fields

- :: NFData a
- => { allocEnv :: Int64 -> IO a
- , cleanEnv :: Int64 -> a -> IO ()
- , runRepeatedly :: a -> Int64 -> IO ()
- , perRun :: Bool
- } -> Benchmarkable

data Benchmark where Source #

Specification of a collection of benchmarks and environments. A benchmark may consist of:

- An environment that creates input data for benchmarks, created with `env`.
- A single `Benchmarkable` item with a name, created with `bench`.
- A (possibly nested) group of `Benchmark`s, created with `bgroup`.

Constructors

Environment :: forall env a. NFData env => IO env -> (env -> IO a) -> (env -> Benchmark) -> Benchmark |
Benchmark :: forall. String -> Benchmarkable -> Benchmark |
BenchGroup :: forall. String -> [Benchmark] -> Benchmark |

Instances

Show Benchmark |
Instance details Defined in Criterion.Measurement.Types Methods showsPrec :: Int -> Benchmark -> ShowS Source # show :: Benchmark -> String Source # showList :: [Benchmark] -> ShowS Source #

# Measurements

data Measured Source #

A collection of measurements made while benchmarking.

Measurements related to garbage collection are tagged with GC. They will only be available if a benchmark is run with `"+RTS -T"`.

Packed storage. When GC statistics cannot be collected, GC values will be set to huge negative values. If a field is labeled with "GC" below, use `fromInt` and `fromDouble` to safely convert to "real" values.

Constructors

Measured |

Fields

- measTime :: !Double

  Total wall-clock time elapsed, in seconds.

- measCpuTime :: !Double

  Total CPU time elapsed, in seconds. Includes both user and kernel (system) time.

- measCycles :: !Int64

  Cycles, in unspecified units that may be CPU cycles. (On i386 and x86_64, this is measured using the `rdtsc` instruction.)

- measIters :: !Int64

  Number of loop iterations measured.

- measAllocated :: !Int64

  (GC) Number of bytes allocated. Access using `fromInt`.

- measNumGcs :: !Int64

  (GC) Number of garbage collections performed. Access using `fromInt`.

- measBytesCopied :: !Int64

  (GC) Number of bytes copied during garbage collection. Access using `fromInt`.

- measMutatorWallSeconds :: !Double

  (GC) Wall-clock time spent doing real work ("mutation"), as distinct from garbage collection. Access using `fromDouble`.

- measMutatorCpuSeconds :: !Double

  (GC) CPU time spent doing real work ("mutation"), as distinct from garbage collection. Access using `fromDouble`.

- measGcWallSeconds :: !Double

  (GC) Wall-clock time spent doing garbage collection. Access using `fromDouble`.

- measGcCpuSeconds :: !Double

  (GC) CPU time spent doing garbage collection. Access using `fromDouble`.

Instances

Eq Measured |
Instance details Defined in Criterion.Measurement.Types Methods (==) :: Measured -> Measured -> Bool Source # (/=) :: Measured -> Measured -> Bool Source #
Data Measured |

Instance details

Defined in Criterion.Measurement.Types

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Measured -> c Measured Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Measured Source #

toConstr :: Measured -> Constr Source #

dataTypeOf :: Measured -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Measured) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Measured) Source #

gmapT :: (forall b. Data b => b -> b) -> Measured -> Measured Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Measured -> r Source #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Measured -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> Measured -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Measured -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Measured -> m Measured Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Measured -> m Measured Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Measured -> m Measured Source #

Read Measured |
Instance details Defined in Criterion.Measurement.Types Methods readsPrec :: Int -> ReadS Measured Source # readList :: ReadS [Measured] Source # readPrec :: ReadPrec Measured Source # readListPrec :: ReadPrec [Measured] Source #
Show Measured |
Instance details Defined in Criterion.Measurement.Types Methods showsPrec :: Int -> Measured -> ShowS Source # show :: Measured -> String Source # showList :: [Measured] -> ShowS Source #
Generic Measured |
Instance details Defined in Criterion.Measurement.Types Associated Types type Rep Measured :: Type -> Type Source # Methods from :: Measured -> Rep Measured x Source # to :: Rep Measured x -> Measured Source #
ToJSON Measured |
Instance details Defined in Criterion.Measurement.Types Methods toJSON :: Measured -> Value Source # toEncoding :: Measured -> Encoding Source # toJSONList :: [Measured] -> Value Source # toEncodingList :: [Measured] -> Encoding Source #
FromJSON Measured |
Instance details Defined in Criterion.Measurement.Types Methods parseJSON :: Value -> Parser Measured Source # parseJSONList :: Value -> Parser [Measured] Source #
Binary Measured |
Instance details Defined in Criterion.Measurement.Types Methods put :: Measured -> Put Source # get :: Get Measured Source # putList :: [Measured] -> Put Source #
NFData Measured |
Instance details Defined in Criterion.Measurement.Types Methods rnf :: Measured -> () Source #
type Rep Measured |

Instance details

Defined in Criterion.Measurement.Types

type Rep Measured = D1 (MetaData "Measured" "Criterion.Measurement.Types" "criterion-measurement-0.1.1.0-3fDm4KCEpBFBQ7na2LANmt" False) (C1 (MetaCons "Measured" PrefixI True) (((S1 (MetaSel (Just "measTime") NoSourceUnpackedness SourceStrict DecidedUnpack) (Rec0 Double) :*: S1 (MetaSel (Just "measCpuTime") NoSourceUnpackedness SourceStrict DecidedUnpack) (Rec0 Double)) :*: (S1 (MetaSel (Just "measCycles") NoSourceUnpackedness SourceStrict DecidedUnpack) (Rec0 Int64) :*: (S1 (MetaSel (Just "measIters") NoSourceUnpackedness SourceStrict DecidedUnpack) (Rec0 Int64) :*: S1 (MetaSel (Just "measAllocated") NoSourceUnpackedness SourceStrict DecidedUnpack) (Rec0 Int64)))) :*: ((S1 (MetaSel (Just "measNumGcs") NoSourceUnpackedness SourceStrict DecidedUnpack) (Rec0 Int64) :*: (S1 (MetaSel (Just "measBytesCopied") NoSourceUnpackedness SourceStrict DecidedUnpack) (Rec0 Int64) :*: S1 (MetaSel (Just "measMutatorWallSeconds") NoSourceUnpackedness SourceStrict DecidedUnpack) (Rec0 Double))) :*: (S1 (MetaSel (Just "measMutatorCpuSeconds") NoSourceUnpackedness SourceStrict DecidedUnpack) (Rec0 Double) :*: (S1 (MetaSel (Just "measGcWallSeconds") NoSourceUnpackedness SourceStrict DecidedUnpack) (Rec0 Double) :*: S1 (MetaSel (Just "measGcCpuSeconds") NoSourceUnpackedness SourceStrict DecidedUnpack) (Rec0 Double))))))

fromInt :: Int64 -> Maybe Int64 Source #

Convert a (possibly unavailable) GC measurement to a true value. If the measurement is a huge negative number that corresponds to "no data", this will return `Nothing`.

toInt :: Maybe Int64 -> Int64 Source #

Convert from a true value back to the packed representation used for GC measurements.

fromDouble :: Double -> Maybe Double Source #

Convert a (possibly unavailable) GC measurement to a true value. If the measurement is a huge negative number that corresponds to "no data", this will return `Nothing`.

toDouble :: Maybe Double -> Double Source #

Convert from a true value back to the packed representation used for GC measurements.

measureAccessors :: Map String (Measured -> Maybe Double, String) Source #

Field names and accessors for a `Measured` record.

measureKeys :: [String] Source #

Field names in a `Measured` record, in the order in which they appear.

measure :: Unbox a => (Measured -> a) -> Vector Measured -> Vector a Source #

rescale :: Measured -> Measured Source #

Normalise every measurement as if `measIters` was 1.

(`measIters` itself is left unaffected.)

# Benchmark construction

env Source #

Arguments

:: NFData env |
=> IO env | Create the environment. The environment will be evaluated to normal form before being passed to the benchmark.
-> (env -> Benchmark) | Take the newly created environment and make it available to the given benchmarks.
-> Benchmark |

Run a benchmark (or collection of benchmarks) in the given environment. The purpose of an environment is to lazily create input data to pass to the functions that will be benchmarked.

A common example of environment data is input that is read from a file. Another is a large data structure constructed in-place.

Motivation. In earlier versions of criterion, all benchmark inputs were always created when a program started running. By deferring the creation of an environment when its associated benchmarks need the its, we avoid two problems that this strategy caused:

- Memory pressure distorted the results of unrelated benchmarks. If one benchmark needed e.g. a gigabyte-sized input, it would force the garbage collector to do extra work when running some other benchmark that had no use for that input. Since the data created by an environment is only available when it is in scope, it should be garbage collected before other benchmarks are run.
- The time cost of generating all needed inputs could be significant in cases where no inputs (or just a few) were really needed. This occurred often, for instance when just one out of a large suite of benchmarks was run, or when a user would list the collection of benchmarks without running any.

Creation. An environment is created right before its related benchmarks are run. The `IO` action that creates the environment is run, then the newly created environment is evaluated to normal form (hence the `NFData` constraint) before being passed to the function that receives the environment.

Complex environments. If you need to create an environment that contains multiple values, simply pack the values into a tuple.

Lazy pattern matching. In situations where a "real" environment is not needed, e.g. if a list of benchmark names is being generated, a value which throws an exception will be passed to the function that receives the environment. This avoids the overhead of generating an environment that will not actually be used.

The function that receives the environment must use lazy pattern matching to deconstruct the tuple (e.g., `~(x, y)`, not `(x, y)`), as use of strict pattern matching will cause a crash if an exception-throwing value is passed in.

Example. This program runs benchmarks in an environment that contains two values. The first value is the contents of a text file; the second is a string. Pay attention to the use of a lazy pattern to deconstruct the tuple in the function that returns the benchmarks to be run.

    setupEnv = do
      let small = replicate 1000 (1 :: Int)
      big <- map length . words <$> readFile "/usr/dict/words"
      return (small, big)

    main = defaultMain [
       -- notice the lazy pattern match here!
       env setupEnv $ \ ~(small,big) -> bgroup "main" [
       bgroup "small" [
         bench "length" $ whnf length small
       , bench "length . filter" $ whnf (length . filter (==1)) small
       ]
     ,  bgroup "big" [
         bench "length" $ whnf length big
       , bench "length . filter" $ whnf (length . filter (==1)) big
       ]
     ] ]

Discussion. The environment created in the example above is intentionally not ideal. As Haskell's scoping rules suggest, the variable `big` is in scope for the benchmarks that use only `small`. It would be better to create a separate environment for `big`, so that it will not be kept alive while the unrelated benchmarks are being run.

envWithCleanup Source #

Arguments

:: NFData env |
=> IO env | Create the environment. The environment will be evaluated to normal form before being passed to the benchmark.
-> (env -> IO a) | Clean up the created environment.
-> (env -> Benchmark) | Take the newly created environment and make it available to the given benchmarks.
-> Benchmark |

Same as `env`, but but allows for an additional callback to clean up the environment. Resource clean up is exception safe, that is, it runs even if the `Benchmark` throws an exception.

perBatchEnv Source #

Arguments

:: (NFData env, NFData b) |
=> (Int64 -> IO env) | Create an environment for a batch of N runs. The environment will be evaluated to normal form before running.
-> (env -> IO b) | Function returning the IO action that should be benchmarked with the newly generated environment.
-> Benchmarkable |

Create a Benchmarkable where a fresh environment is allocated for every batch of runs of the benchmarkable.

The environment is evaluated to normal form before the benchmark is run.

When using `whnf`, `whnfIO`, etc. Criterion creates a `Benchmarkable` whichs runs a batch of `N` repeat runs of that expressions. Criterion may run any number of these batches to get accurate measurements. Environments created by `env` and `envWithCleanup`, are shared across all these batches of runs.

This is fine for simple benchmarks on static input, but when benchmarking IO operations where these operations can modify (and especially grow) the environment this means that later batches might have their accuracy effected due to longer, for example, longer garbage collection pauses.

An example: Suppose we want to benchmark writing to a Chan, if we allocate the Chan using environment and our benchmark consists of `writeChan env ()`, the contents and thus size of the Chan will grow with every repeat. If Criterion runs a 1,000 batches of 1,000 repeats, the result is that the channel will have 999,000 items in it by the time the last batch is run. Since GHC GC has to copy the live set for every major GC this means our last set of writes will suffer a lot of noise of the previous repeats.

By allocating a fresh environment for every batch of runs this function should eliminate this effect.

perBatchEnvWithCleanup Source #

Arguments

:: (NFData env, NFData b) |
=> (Int64 -> IO env) | Create an environment for a batch of N runs. The environment will be evaluated to normal form before running.
-> (Int64 -> env -> IO ()) | Clean up the created environment.
-> (env -> IO b) | Function returning the IO action that should be benchmarked with the newly generated environment.
-> Benchmarkable |

Same as `perBatchEnv`, but but allows for an additional callback to clean up the environment. Resource clean up is exception safe, that is, it runs even if the `Benchmark` throws an exception.

perRunEnv Source #

Arguments

:: (NFData env, NFData b) |
=> IO env | Action that creates the environment for a single run.
-> (env -> IO b) | Function returning the IO action that should be benchmarked with the newly genereted environment.
-> Benchmarkable |

Create a Benchmarkable where a fresh environment is allocated for every run of the operation to benchmark. This is useful for benchmarking mutable operations that need a fresh environment, such as sorting a mutable Vector.

As with `env` and `perBatchEnv` the environment is evaluated to normal form before the benchmark is run.

This introduces extra noise and result in reduce accuracy compared to other Criterion benchmarks. But allows easier benchmarking for mutable operations than was previously possible.

perRunEnvWithCleanup Source #

Arguments

:: (NFData env, NFData b) |
=> IO env | Action that creates the environment for a single run.
-> (env -> IO ()) | Clean up the created environment.
-> (env -> IO b) | Function returning the IO action that should be benchmarked with the newly genereted environment.
-> Benchmarkable |

Same as `perRunEnv`, but but allows for an additional callback to clean up the environment. Resource clean up is exception safe, that is, it runs even if the `Benchmark` throws an exception.

toBenchmarkable :: (Int64 -> IO ()) -> Benchmarkable Source #

Construct a `Benchmarkable` value from an impure action, where the `Int64` parameter indicates the number of times to run the action.

bench Source #

Arguments

:: String | A name to identify the benchmark.
-> Benchmarkable | An activity to be benchmarked.
-> Benchmark |

Create a single benchmark.

bgroup Source #

Arguments

:: String | A name to identify the group of benchmarks.
-> [Benchmark] | Benchmarks to group under this name.
-> Benchmark |

Group several benchmarks together under a common name.

addPrefix Source #

Arguments

:: String | Prefix.
-> String | Name.
-> String |

Add the given prefix to a name. If the prefix is empty, the name is returned unmodified. Otherwise, the prefix and name are separated by a `'/'` character.

benchNames :: Benchmark -> [String] Source #

Retrieve the names of all benchmarks. Grouped benchmarks are prefixed with the name of the group they're in.

## Evaluation control

nf :: NFData b => (a -> b) -> a -> Benchmarkable Source #

Apply an argument to a function, and evaluate the result to normal form (NF).

whnf :: (a -> b) -> a -> Benchmarkable Source #

Apply an argument to a function, and evaluate the result to weak head normal form (WHNF).

nfIO :: NFData a => IO a -> Benchmarkable Source #

Perform an action, then evaluate its result to normal form (NF). This is particularly useful for forcing a lazy `IO` action to be completely performed.

If the construction of the 'IO a' value is an important factor in the benchmark, it is best to use `nfAppIO` instead.

whnfIO :: IO a -> Benchmarkable Source #

Perform an action, then evaluate its result to weak head normal form (WHNF). This is useful for forcing an `IO` action whose result is an expression to be evaluated down to a more useful value.

If the construction of the 'IO a' value is an important factor in the benchmark, it is best to use `whnfAppIO` instead.

nfAppIO :: NFData b => (a -> IO b) -> a -> Benchmarkable Source #

Apply an argument to a function which performs an action, then evaluate its result to normal form (NF). This function constructs the 'IO b' value on each iteration, similar to `nf`. This is particularly useful for `IO` actions where the bulk of the work is not bound by IO, but by pure computations that may optimize away if the argument is known statically, as in `nfIO`.

whnfAppIO :: (a -> IO b) -> a -> Benchmarkable Source #

Perform an action, then evaluate its result to weak head normal form (WHNF). This function constructs the 'IO b' value on each iteration, similar to `whnf`. This is particularly useful for `IO` actions where the bulk of the work is not bound by IO, but by pure computations that may optimize away if the argument is known statically, as in `nfIO`.

# Result types

data Outliers Source #

Outliers from sample data, calculated using the boxplot technique.

Constructors

Outliers |

Fields

- samplesSeen :: !Int64
- lowSevere :: !Int64

  More than 3 times the interquartile range (IQR) below the first quartile.

- lowMild :: !Int64

  Between 1.5 and 3 times the IQR below the first quartile.

- highMild :: !Int64

  Between 1.5 and 3 times the IQR above the third quartile.

- highSevere :: !Int64

  More than 3 times the IQR above the third quartile.

Instances

Eq Outliers Source # |
Instance details Defined in Criterion.Types Methods (==) :: Outliers -> Outliers -> Bool Source # (/=) :: Outliers -> Outliers -> Bool Source #
Data Outliers Source # |

Instance details

Defined in Criterion.Types

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Outliers -> c Outliers Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Outliers Source #

toConstr :: Outliers -> Constr Source #

dataTypeOf :: Outliers -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Outliers) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Outliers) Source #

gmapT :: (forall b. Data b => b -> b) -> Outliers -> Outliers Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Outliers -> r Source #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Outliers -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> Outliers -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Outliers -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Outliers -> m Outliers Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Outliers -> m Outliers Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Outliers -> m Outliers Source #

Read Outliers Source # |
Instance details Defined in Criterion.Types Methods readsPrec :: Int -> ReadS Outliers Source # readList :: ReadS [Outliers] Source # readPrec :: ReadPrec Outliers Source # readListPrec :: ReadPrec [Outliers] Source #
Show Outliers Source # |
Instance details Defined in Criterion.Types Methods showsPrec :: Int -> Outliers -> ShowS Source # show :: Outliers -> String Source # showList :: [Outliers] -> ShowS Source #
Generic Outliers Source # |
Instance details Defined in Criterion.Types Associated Types type Rep Outliers :: Type -> Type Source # Methods from :: Outliers -> Rep Outliers x Source # to :: Rep Outliers x -> Outliers Source #
Semigroup Outliers Source # |
Instance details Defined in Criterion.Types Methods (<>) :: Outliers -> Outliers -> Outliers Source # sconcat :: NonEmpty Outliers -> Outliers Source # stimes :: Integral b => b -> Outliers -> Outliers Source #
Monoid Outliers Source # |
Instance details Defined in Criterion.Types Methods mempty :: Outliers Source # mappend :: Outliers -> Outliers -> Outliers Source # mconcat :: [Outliers] -> Outliers Source #
ToJSON Outliers Source # |
Instance details Defined in Criterion.Types Methods toJSON :: Outliers -> Value Source # toEncoding :: Outliers -> Encoding Source # toJSONList :: [Outliers] -> Value Source # toEncodingList :: [Outliers] -> Encoding Source #
FromJSON Outliers Source # |
Instance details Defined in Criterion.Types Methods parseJSON :: Value -> Parser Outliers Source # parseJSONList :: Value -> Parser [Outliers] Source #
Binary Outliers Source # |
Instance details Defined in Criterion.Types Methods put :: Outliers -> Put Source # get :: Get Outliers Source # putList :: [Outliers] -> Put Source #
NFData Outliers Source # |
Instance details Defined in Criterion.Types Methods rnf :: Outliers -> () Source #
type Rep Outliers Source # |

Instance details

Defined in Criterion.Types

type Rep Outliers = D1 (MetaData "Outliers" "Criterion.Types" "criterion-1.5.5.0-JhSXImw0TG1I5gwSxjGZK3" False) (C1 (MetaCons "Outliers" PrefixI True) ((S1 (MetaSel (Just "samplesSeen") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Int64) :*: S1 (MetaSel (Just "lowSevere") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Int64)) :*: (S1 (MetaSel (Just "lowMild") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Int64) :*: (S1 (MetaSel (Just "highMild") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Int64) :*: S1 (MetaSel (Just "highSevere") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Int64)))))

data OutlierEffect Source #

A description of the extent to which outliers in the sample data affect the sample mean and standard deviation.

Constructors

Unaffected | Less than 1% effect.
Slight | Between 1% and 10%.
Moderate | Between 10% and 50%.
Severe | Above 50% (i.e. measurements are useless).

Instances

Eq OutlierEffect Source # |
Instance details Defined in Criterion.Types Methods (==) :: OutlierEffect -> OutlierEffect -> Bool Source # (/=) :: OutlierEffect -> OutlierEffect -> Bool Source #
Data OutlierEffect Source # |

Instance details

Defined in Criterion.Types

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> OutlierEffect -> c OutlierEffect Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c OutlierEffect Source #

toConstr :: OutlierEffect -> Constr Source #

dataTypeOf :: OutlierEffect -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c OutlierEffect) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c OutlierEffect) Source #

gmapT :: (forall b. Data b => b -> b) -> OutlierEffect -> OutlierEffect Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> OutlierEffect -> r Source #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> OutlierEffect -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> OutlierEffect -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> OutlierEffect -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> OutlierEffect -> m OutlierEffect Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> OutlierEffect -> m OutlierEffect Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> OutlierEffect -> m OutlierEffect Source #

Ord OutlierEffect Source # |

Instance details

Defined in Criterion.Types

Methods

compare :: OutlierEffect -> OutlierEffect -> Ordering Source #

(<) :: OutlierEffect -> OutlierEffect -> Bool Source #

(<=) :: OutlierEffect -> OutlierEffect -> Bool Source #

(>) :: OutlierEffect -> OutlierEffect -> Bool Source #

(>=) :: OutlierEffect -> OutlierEffect -> Bool Source #

max :: OutlierEffect -> OutlierEffect -> OutlierEffect Source #

min :: OutlierEffect -> OutlierEffect -> OutlierEffect Source #

Read OutlierEffect Source # |
Instance details Defined in Criterion.Types Methods readsPrec :: Int -> ReadS OutlierEffect Source # readList :: ReadS [OutlierEffect] Source # readPrec :: ReadPrec OutlierEffect Source # readListPrec :: ReadPrec [OutlierEffect] Source #
Show OutlierEffect Source # |
Instance details Defined in Criterion.Types Methods showsPrec :: Int -> OutlierEffect -> ShowS Source # show :: OutlierEffect -> String Source # showList :: [OutlierEffect] -> ShowS Source #
Generic OutlierEffect Source # |
Instance details Defined in Criterion.Types Associated Types type Rep OutlierEffect :: Type -> Type Source # Methods from :: OutlierEffect -> Rep OutlierEffect x Source # to :: Rep OutlierEffect x -> OutlierEffect Source #
ToJSON OutlierEffect Source # |
Instance details Defined in Criterion.Types Methods toJSON :: OutlierEffect -> Value Source # toEncoding :: OutlierEffect -> Encoding Source # toJSONList :: [OutlierEffect] -> Value Source # toEncodingList :: [OutlierEffect] -> Encoding Source #
FromJSON OutlierEffect Source # |
Instance details Defined in Criterion.Types Methods parseJSON :: Value -> Parser OutlierEffect Source # parseJSONList :: Value -> Parser [OutlierEffect] Source #
Binary OutlierEffect Source # |
Instance details Defined in Criterion.Types Methods put :: OutlierEffect -> Put Source # get :: Get OutlierEffect Source # putList :: [OutlierEffect] -> Put Source #
NFData OutlierEffect Source # |
Instance details Defined in Criterion.Types Methods rnf :: OutlierEffect -> () Source #
type Rep OutlierEffect Source # |

Instance details

Defined in Criterion.Types

type Rep OutlierEffect = D1 (MetaData "OutlierEffect" "Criterion.Types" "criterion-1.5.5.0-JhSXImw0TG1I5gwSxjGZK3" False) ((C1 (MetaCons "Unaffected" PrefixI False) (U1 :: Type -> Type) :+: C1 (MetaCons "Slight" PrefixI False) (U1 :: Type -> Type)) :+: (C1 (MetaCons "Moderate" PrefixI False) (U1 :: Type -> Type) :+: C1 (MetaCons "Severe" PrefixI False) (U1 :: Type -> Type)))

data OutlierVariance Source #

Analysis of the extent to which outliers in a sample affect its standard deviation (and to some extent, its mean).

Constructors

OutlierVariance |

Fields

- ovEffect :: OutlierEffect

  Qualitative description of effect.

- ovDesc :: String

  Brief textual description of effect.

- ovFraction :: Double

  Quantitative description of effect (a fraction between 0 and 1).

Instances

Eq OutlierVariance Source # |
Instance details Defined in Criterion.Types Methods (==) :: OutlierVariance -> OutlierVariance -> Bool Source # (/=) :: OutlierVariance -> OutlierVariance -> Bool Source #
Data OutlierVariance Source # |

Instance details

Defined in Criterion.Types

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> OutlierVariance -> c OutlierVariance Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c OutlierVariance Source #

toConstr :: OutlierVariance -> Constr Source #

dataTypeOf :: OutlierVariance -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c OutlierVariance) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c OutlierVariance) Source #

gmapT :: (forall b. Data b => b -> b) -> OutlierVariance -> OutlierVariance Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> OutlierVariance -> r Source #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> OutlierVariance -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> OutlierVariance -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> OutlierVariance -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> OutlierVariance -> m OutlierVariance Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> OutlierVariance -> m OutlierVariance Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> OutlierVariance -> m OutlierVariance Source #

Read OutlierVariance Source # |
Instance details Defined in Criterion.Types Methods readsPrec :: Int -> ReadS OutlierVariance Source # readList :: ReadS [OutlierVariance] Source # readPrec :: ReadPrec OutlierVariance Source # readListPrec :: ReadPrec [OutlierVariance] Source #
Show OutlierVariance Source # |
Instance details Defined in Criterion.Types Methods showsPrec :: Int -> OutlierVariance -> ShowS Source # show :: OutlierVariance -> String Source # showList :: [OutlierVariance] -> ShowS Source #
Generic OutlierVariance Source # |
Instance details Defined in Criterion.Types Associated Types type Rep OutlierVariance :: Type -> Type Source # Methods from :: OutlierVariance -> Rep OutlierVariance x Source # to :: Rep OutlierVariance x -> OutlierVariance Source #
ToJSON OutlierVariance Source # |
Instance details Defined in Criterion.Types Methods toJSON :: OutlierVariance -> Value Source # toEncoding :: OutlierVariance -> Encoding Source # toJSONList :: [OutlierVariance] -> Value Source # toEncodingList :: [OutlierVariance] -> Encoding Source #
FromJSON OutlierVariance Source # |
Instance details Defined in Criterion.Types Methods parseJSON :: Value -> Parser OutlierVariance Source # parseJSONList :: Value -> Parser [OutlierVariance] Source #
Binary OutlierVariance Source # |
Instance details Defined in Criterion.Types Methods put :: OutlierVariance -> Put Source # get :: Get OutlierVariance Source # putList :: [OutlierVariance] -> Put Source #
NFData OutlierVariance Source # |
Instance details Defined in Criterion.Types Methods rnf :: OutlierVariance -> () Source #
type Rep OutlierVariance Source # |

Instance details

Defined in Criterion.Types

type Rep OutlierVariance = D1 (MetaData "OutlierVariance" "Criterion.Types" "criterion-1.5.5.0-JhSXImw0TG1I5gwSxjGZK3" False) (C1 (MetaCons "OutlierVariance" PrefixI True) (S1 (MetaSel (Just "ovEffect") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 OutlierEffect) :*: (S1 (MetaSel (Just "ovDesc") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 String) :*: S1 (MetaSel (Just "ovFraction") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Double))))

data Regression Source #

Results of a linear regression.

Constructors

Regression |

Fields

- regResponder :: String

  Name of the responding variable.

- regCoeffs :: Map String (Estimate ConfInt Double)

  Map from name to value of predictor coefficients.

- regRSquare :: Estimate ConfInt Double

  R² goodness-of-fit estimate.

Instances

Eq Regression Source # |
Instance details Defined in Criterion.Types Methods (==) :: Regression -> Regression -> Bool Source # (/=) :: Regression -> Regression -> Bool Source #
Read Regression Source # |
Instance details Defined in Criterion.Types Methods readsPrec :: Int -> ReadS Regression Source # readList :: ReadS [Regression] Source # readPrec :: ReadPrec Regression Source # readListPrec :: ReadPrec [Regression] Source #
Show Regression Source # |
Instance details Defined in Criterion.Types Methods showsPrec :: Int -> Regression -> ShowS Source # show :: Regression -> String Source # showList :: [Regression] -> ShowS Source #
Generic Regression Source # |
Instance details Defined in Criterion.Types Associated Types type Rep Regression :: Type -> Type Source # Methods from :: Regression -> Rep Regression x Source # to :: Rep Regression x -> Regression Source #
ToJSON Regression Source # |
Instance details Defined in Criterion.Types Methods toJSON :: Regression -> Value Source # toEncoding :: Regression -> Encoding Source # toJSONList :: [Regression] -> Value Source # toEncodingList :: [Regression] -> Encoding Source #
FromJSON Regression Source # |
Instance details Defined in Criterion.Types Methods parseJSON :: Value -> Parser Regression Source # parseJSONList :: Value -> Parser [Regression] Source #
Binary Regression Source # |
Instance details Defined in Criterion.Types Methods put :: Regression -> Put Source # get :: Get Regression Source # putList :: [Regression] -> Put Source #
NFData Regression Source # |
Instance details Defined in Criterion.Types Methods rnf :: Regression -> () Source #
type Rep Regression Source # |

Instance details

Defined in Criterion.Types

type Rep Regression = D1 (MetaData "Regression" "Criterion.Types" "criterion-1.5.5.0-JhSXImw0TG1I5gwSxjGZK3" False) (C1 (MetaCons "Regression" PrefixI True) (S1 (MetaSel (Just "regResponder") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 String) :*: (S1 (MetaSel (Just "regCoeffs") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Map String (Estimate ConfInt Double))) :*: S1 (MetaSel (Just "regRSquare") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Estimate ConfInt Double)))))

data KDE Source #

Data for a KDE chart of performance.

Constructors

KDE |

Fields

- kdeType :: String
- kdeValues :: Vector Double
- kdePDF :: Vector Double

Instances

Eq KDE Source # |
Instance details Defined in Criterion.Types Methods (==) :: KDE -> KDE -> Bool Source # (/=) :: KDE -> KDE -> Bool Source #
Data KDE Source # |

Instance details

Defined in Criterion.Types

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> KDE -> c KDE Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c KDE Source #

toConstr :: KDE -> Constr Source #

dataTypeOf :: KDE -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c KDE) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c KDE) Source #

gmapT :: (forall b. Data b => b -> b) -> KDE -> KDE Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> KDE -> r Source #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> KDE -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> KDE -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> KDE -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> KDE -> m KDE Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> KDE -> m KDE Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> KDE -> m KDE Source #

Read KDE Source # |
Instance details Defined in Criterion.Types Methods readsPrec :: Int -> ReadS KDE Source # readList :: ReadS [KDE] Source # readPrec :: ReadPrec KDE Source # readListPrec :: ReadPrec [KDE] Source #
Show KDE Source # |
Instance details Defined in Criterion.Types Methods showsPrec :: Int -> KDE -> ShowS Source # show :: KDE -> String Source # showList :: [KDE] -> ShowS Source #
Generic KDE Source # |
Instance details Defined in Criterion.Types Associated Types type Rep KDE :: Type -> Type Source # Methods from :: KDE -> Rep KDE x Source # to :: Rep KDE x -> KDE Source #
ToJSON KDE Source # |
Instance details Defined in Criterion.Types Methods toJSON :: KDE -> Value Source # toEncoding :: KDE -> Encoding Source # toJSONList :: [KDE] -> Value Source # toEncodingList :: [KDE] -> Encoding Source #
FromJSON KDE Source # |
Instance details Defined in Criterion.Types Methods parseJSON :: Value -> Parser KDE Source # parseJSONList :: Value -> Parser [KDE] Source #
Binary KDE Source # |
Instance details Defined in Criterion.Types Methods put :: KDE -> Put Source # get :: Get KDE Source # putList :: [KDE] -> Put Source #
NFData KDE Source # |
Instance details Defined in Criterion.Types Methods rnf :: KDE -> () Source #
type Rep KDE Source # |

Instance details

Defined in Criterion.Types

type Rep KDE = D1 (MetaData "KDE" "Criterion.Types" "criterion-1.5.5.0-JhSXImw0TG1I5gwSxjGZK3" False) (C1 (MetaCons "KDE" PrefixI True) (S1 (MetaSel (Just "kdeType") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 String) :*: (S1 (MetaSel (Just "kdeValues") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Vector Double)) :*: S1 (MetaSel (Just "kdePDF") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Vector Double)))))

data Report Source #

Report of a sample analysis.

Constructors

Report |

Fields

- reportNumber :: Int

  A simple index indicating that this is the nth report.

- reportName :: String

  The name of this report.

- reportKeys :: [String]

  See `measureKeys`.

- reportMeasured :: Vector Measured

  Raw measurements.

- reportAnalysis :: SampleAnalysis

  Report analysis.

- reportOutliers :: Outliers

  Analysis of outliers.

- reportKDEs :: [KDE]

  Data for a KDE of times.

Instances

Eq Report Source # |
Instance details Defined in Criterion.Types Methods (==) :: Report -> Report -> Bool Source # (/=) :: Report -> Report -> Bool Source #
Read Report Source # |
Instance details Defined in Criterion.Types Methods readsPrec :: Int -> ReadS Report Source # readList :: ReadS [Report] Source # readPrec :: ReadPrec Report Source # readListPrec :: ReadPrec [Report] Source #
Show Report Source # |
Instance details Defined in Criterion.Types Methods showsPrec :: Int -> Report -> ShowS Source # show :: Report -> String Source # showList :: [Report] -> ShowS Source #
Generic Report Source # |
Instance details Defined in Criterion.Types Associated Types type Rep Report :: Type -> Type Source # Methods from :: Report -> Rep Report x Source # to :: Rep Report x -> Report Source #
ToJSON Report Source # |
Instance details Defined in Criterion.Types Methods toJSON :: Report -> Value Source # toEncoding :: Report -> Encoding Source # toJSONList :: [Report] -> Value Source # toEncodingList :: [Report] -> Encoding Source #
FromJSON Report Source # |
Instance details Defined in Criterion.Types Methods parseJSON :: Value -> Parser Report Source # parseJSONList :: Value -> Parser [Report] Source #
Binary Report Source # |
Instance details Defined in Criterion.Types Methods put :: Report -> Put Source # get :: Get Report Source # putList :: [Report] -> Put Source #
NFData Report Source # |
Instance details Defined in Criterion.Types Methods rnf :: Report -> () Source #
type Rep Report Source # |

Instance details

Defined in Criterion.Types

type Rep Report = D1 (MetaData "Report" "Criterion.Types" "criterion-1.5.5.0-JhSXImw0TG1I5gwSxjGZK3" False) (C1 (MetaCons "Report" PrefixI True) ((S1 (MetaSel (Just "reportNumber") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Int) :*: (S1 (MetaSel (Just "reportName") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 String) :*: S1 (MetaSel (Just "reportKeys") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [String]))) :*: ((S1 (MetaSel (Just "reportMeasured") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Vector Measured)) :*: S1 (MetaSel (Just "reportAnalysis") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 SampleAnalysis)) :*: (S1 (MetaSel (Just "reportOutliers") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Outliers) :*: S1 (MetaSel (Just "reportKDEs") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [KDE])))))

data SampleAnalysis Source #

Result of a bootstrap analysis of a non-parametric sample.

Constructors

SampleAnalysis |

Fields

- anRegress :: [Regression]

  Estimates calculated via linear regression.

- anMean :: Estimate ConfInt Double

  Estimated mean.

- anStdDev :: Estimate ConfInt Double

  Estimated standard deviation.

- anOutlierVar :: OutlierVariance

  Description of the effects of outliers on the estimated variance.

Instances

Eq SampleAnalysis Source # |
Instance details Defined in Criterion.Types Methods (==) :: SampleAnalysis -> SampleAnalysis -> Bool Source # (/=) :: SampleAnalysis -> SampleAnalysis -> Bool Source #
Read SampleAnalysis Source # |
Instance details Defined in Criterion.Types Methods readsPrec :: Int -> ReadS SampleAnalysis Source # readList :: ReadS [SampleAnalysis] Source # readPrec :: ReadPrec SampleAnalysis Source # readListPrec :: ReadPrec [SampleAnalysis] Source #
Show SampleAnalysis Source # |
Instance details Defined in Criterion.Types Methods showsPrec :: Int -> SampleAnalysis -> ShowS Source # show :: SampleAnalysis -> String Source # showList :: [SampleAnalysis] -> ShowS Source #
Generic SampleAnalysis Source # |
Instance details Defined in Criterion.Types Associated Types type Rep SampleAnalysis :: Type -> Type Source # Methods from :: SampleAnalysis -> Rep SampleAnalysis x Source # to :: Rep SampleAnalysis x -> SampleAnalysis Source #
ToJSON SampleAnalysis Source # |
Instance details Defined in Criterion.Types Methods toJSON :: SampleAnalysis -> Value Source # toEncoding :: SampleAnalysis -> Encoding Source # toJSONList :: [SampleAnalysis] -> Value Source # toEncodingList :: [SampleAnalysis] -> Encoding Source #
FromJSON SampleAnalysis Source # |
Instance details Defined in Criterion.Types Methods parseJSON :: Value -> Parser SampleAnalysis Source # parseJSONList :: Value -> Parser [SampleAnalysis] Source #
Binary SampleAnalysis Source # |
Instance details Defined in Criterion.Types Methods put :: SampleAnalysis -> Put Source # get :: Get SampleAnalysis Source # putList :: [SampleAnalysis] -> Put Source #
NFData SampleAnalysis Source # |
Instance details Defined in Criterion.Types Methods rnf :: SampleAnalysis -> () Source #
type Rep SampleAnalysis Source # |

Instance details

Defined in Criterion.Types

type Rep SampleAnalysis = D1 (MetaData "SampleAnalysis" "Criterion.Types" "criterion-1.5.5.0-JhSXImw0TG1I5gwSxjGZK3" False) (C1 (MetaCons "SampleAnalysis" PrefixI True) ((S1 (MetaSel (Just "anRegress") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [Regression]) :*: S1 (MetaSel (Just "anMean") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Estimate ConfInt Double))) :*: (S1 (MetaSel (Just "anStdDev") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Estimate ConfInt Double)) :*: S1 (MetaSel (Just "anOutlierVar") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 OutlierVariance))))

data DataRecord Source #

Constructors

Measurement Int String (Vector Measured) |
Analysed Report |

Instances

Eq DataRecord Source # |
Instance details Defined in Criterion.Types Methods (==) :: DataRecord -> DataRecord -> Bool Source # (/=) :: DataRecord -> DataRecord -> Bool Source #
Read DataRecord Source # |
Instance details Defined in Criterion.Types Methods readsPrec :: Int -> ReadS DataRecord Source # readList :: ReadS [DataRecord] Source # readPrec :: ReadPrec DataRecord Source # readListPrec :: ReadPrec [DataRecord] Source #
Show DataRecord Source # |
Instance details Defined in Criterion.Types Methods showsPrec :: Int -> DataRecord -> ShowS Source # show :: DataRecord -> String Source # showList :: [DataRecord] -> ShowS Source #
Generic DataRecord Source # |
Instance details Defined in Criterion.Types Associated Types type Rep DataRecord :: Type -> Type Source # Methods from :: DataRecord -> Rep DataRecord x Source # to :: Rep DataRecord x -> DataRecord Source #
ToJSON DataRecord Source # |
Instance details Defined in Criterion.Types Methods toJSON :: DataRecord -> Value Source # toEncoding :: DataRecord -> Encoding Source # toJSONList :: [DataRecord] -> Value Source # toEncodingList :: [DataRecord] -> Encoding Source #
FromJSON DataRecord Source # |
Instance details Defined in Criterion.Types Methods parseJSON :: Value -> Parser DataRecord Source # parseJSONList :: Value -> Parser [DataRecord] Source #
Binary DataRecord Source # |
Instance details Defined in Criterion.Types Methods put :: DataRecord -> Put Source # get :: Get DataRecord Source # putList :: [DataRecord] -> Put Source #
NFData DataRecord Source # |
Instance details Defined in Criterion.Types Methods rnf :: DataRecord -> () Source #
type Rep DataRecord Source # |

Instance details

Defined in Criterion.Types

type Rep DataRecord = D1 (MetaData "DataRecord" "Criterion.Types" "criterion-1.5.5.0-JhSXImw0TG1I5gwSxjGZK3" False) (C1 (MetaCons "Measurement" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Int) :*: (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 String) :*: S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Vector Measured)))) :+: C1 (MetaCons "Analysed" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Report)))