| Safe Haskell | Safe-Inferred |
|---|---|
| Language | GHC2021 |
Plutarch.Test.Bench
Contents
Description
Plutarch benchmarking tools
Interface mirrors the one from tasty-bench but bench instead of taking Benchmarkable
takes ClosedTerm
To compare benchmark run against baseline file you need to generate it first with
cabal run bench -- --csv baseline.csv. Then after making modifications you can rerun the
benchmarks to compare with previous values with cabal run bench -- --baseline baseline.csv.
You can instruct benchmarks to fail if certain values changed by too much using --fail-if-*
flags. See cabal run bench -- --help for all available flags. To regenreate baseline file
run with --csv flag again.
Synopsis
- data BenchConfig
- = Optimizing
- | NonOptimizing Config
- defaultMain :: TestTree -> IO ()
- bench :: TestName -> ClosedTerm a -> TestTree
- benchWithConfig :: TestName -> BenchConfig -> ClosedTerm a -> TestTree
- bcompare :: String -> TestTree -> TestTree
- bcompareWithin :: (Double, Double) -> (Double, Double) -> (Double, Double) -> String -> TestTree -> TestTree
- data BaselinePath
- data CsvPath
- data FailIfMoreCpu
- data FailIfLessCpu
- data FailIfMoreMem
- data FailIfLessMem
- data FailIfBigger
- data FailIfSmaller
- consoleBenchReporter :: Ingredient
- csvReporter :: Ingredient
Documentation
data BenchConfig Source #
Since: 1.0.0
Constructors
| Optimizing | Compile with UPLC simplifier pass and no tracing |
| NonOptimizing Config | Compile without UPLC simplifier and configurable tracing |
defaultMain :: TestTree -> IO () Source #
Use this instead of defaultMain from Test.Tasty to run benchmarks to get formatted output
Since: 1.0.0
bench :: TestName -> ClosedTerm a -> TestTree Source #
Create benchmark from Plutarch term without tracing and no UPLC simplifier
Since: 1.0.0
benchWithConfig :: TestName -> BenchConfig -> ClosedTerm a -> TestTree Source #
Like bench but with customizable compilation config
Since: 1.0.0
Arguments
| :: String | Tasty pattern to compare as baseline |
| -> TestTree | Test or test tree to compare with baseline test |
| -> TestTree |
Compare benchmarks, reporting relative CPU, MEM, and size differences
Since: 1.0.0
Arguments
| :: (Double, Double) | CPU bounds |
| -> (Double, Double) | MEM bounds |
| -> (Double, Double) | Size bounds |
| -> String | Tasty pattern to compare as baseline |
| -> TestTree | Test or test tree to compare with baseline test |
| -> TestTree |
Like bcompare but with customizable upper and lower bounds of relative differences
Since: 1.0.0
CLI options
Benchmarks can be compared against CSV file and fail if they differ too much.
Run cabal run bench -- --help to see available flags and descriptions.
These options are available by default when running benchmarks in defaultMain
data BaselinePath Source #
Since: 1.0.0
Instances
Since: 1.0.0
Instances
| Eq CsvPath Source # | Since: 1.0.0 |
| Ord CsvPath Source # | Since: 1.0.0 |
Defined in Plutarch.Test.Bench | |
| IsOption (Maybe CsvPath) Source # | Since: 1.0.0 |
Defined in Plutarch.Test.Bench Methods parseValue :: String -> Maybe (Maybe CsvPath) optionName :: Tagged (Maybe CsvPath) String optionHelp :: Tagged (Maybe CsvPath) String showDefaultValue :: Maybe CsvPath -> Maybe String optionCLParser :: Parser (Maybe CsvPath) | |
data FailIfMoreCpu Source #
Since: 1.0.0
Instances
data FailIfLessCpu Source #
Since: 1.0.0
Instances
data FailIfMoreMem Source #
Since: 1.0.0
Instances
data FailIfLessMem Source #
Since: 1.0.0
Instances
data FailIfBigger Source #
Since: 1.0.0
Instances
data FailIfSmaller Source #
Since: 1.0.0
Instances
Ingredients
These are used by default in defaultMain.
You do not need to do anything with them unless you build your own benchmark runner
consoleBenchReporter :: Ingredient Source #
Since: 1.0.0
csvReporter :: Ingredient Source #
Since: 1.0.0