Portability | GHC |
---|---|
Stability | experimental |
Maintainer | bos@serpentine.com |
Core benchmarking code.
- class Benchmarkable a where
- data Benchmark
- data Pure
- nf :: NFData b => (a -> b) -> a -> Pure
- whnf :: (a -> b) -> a -> Pure
- nfIO :: NFData a => IO a -> IO ()
- whnfIO :: NFData a => IO a -> IO ()
- bench :: Benchmarkable b => String -> b -> Benchmark
- bgroup :: String -> [Benchmark] -> Benchmark
- runBenchmark :: Benchmarkable b => Environment -> b -> Criterion Sample
- runAndAnalyse :: (String -> Bool) -> Environment -> Benchmark -> Criterion ()
Documentation
class Benchmarkable a whereSource
A benchmarkable function or action.
Run a function or action the specified number of times.
A benchmark may consist of either a single Benchmarkable
item
with a name, created with bench
, or a (possibly nested) group of
Benchmark
s, created with bgroup
.
A container for a pure function to benchmark, and an argument to supply to it each time it is evaluated.
nf :: NFData b => (a -> b) -> a -> PureSource
Apply an argument to a function, and evaluate the result to head normal form (NF).
whnf :: (a -> b) -> a -> PureSource
Apply an argument to a function, and evaluate the result to weak head normal form (WHNF).
nfIO :: NFData a => IO a -> IO ()Source
Perform an action, then evaluate its result to head normal form. This is particularly useful for forcing a lazy IO action to be completely performed.
whnfIO :: NFData a => IO a -> IO ()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.
:: Benchmarkable b | |
=> String | A name to identify the benchmark. |
-> b | |
-> Benchmark |
Create a single benchmark.
:: 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.
runBenchmark :: Benchmarkable b => Environment -> b -> Criterion SampleSource
Run a single benchmark, and return timings measured when executing it.