Types for benchmarking.
For a pure function of type
a -> b, the benchmarking harness
calls this function repeatedly, each time with a different
argument, and reduces the result the function returns to weak head
normal form. If you need the result reduced to normal form, that
is your responsibility.
For an action of type
IO a, the benchmarking harness calls the
action repeatedly, but does not reduce the result.
- class Benchmarkable a where
- data Benchmark where
- data Pure
- whnf :: (a -> b) -> a -> Pure
- nf :: NFData b => (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
- benchNames :: Benchmark -> [String]
A benchmarkable function or action.
Run a function or action the specified number of times.
|Benchmark :: Benchmarkable b => String -> b -> Benchmark|
|BenchGroup :: String -> [Benchmark] -> Benchmark|
A container for a pure function to benchmark, and an argument to supply to it each time it is evaluated.
Apply an argument to a function, and evaluate the result to weak head normal form (WHNF).
Apply an argument to a function, and evaluate the result to head normal form (NF).
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.
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.
Create a single benchmark.
A name to identify the group of benchmarks.
Benchmarks to group under this name.
Group several benchmarks together under a common name.