Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
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 WIP
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 WIP
bench :: TestName -> ClosedTerm a -> TestTree Source #
Create benchmark from Plutarch term without tracing and no UPLC simplifier
@since WIP
benchWithConfig :: TestName -> BenchConfig -> ClosedTerm a -> TestTree Source #
Like bench
but with customizable compilation config
@since WIP
:: 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 WIP
:: (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 WIP
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 WIP
Instances
Eq BaselinePath Source # | @since WIP |
Defined in Plutarch.Test.Bench (==) :: BaselinePath -> BaselinePath -> Bool Source # (/=) :: BaselinePath -> BaselinePath -> Bool Source # | |
Ord BaselinePath Source # | @since WIP |
Defined in Plutarch.Test.Bench compare :: BaselinePath -> BaselinePath -> Ordering Source # (<) :: BaselinePath -> BaselinePath -> Bool Source # (<=) :: BaselinePath -> BaselinePath -> Bool Source # (>) :: BaselinePath -> BaselinePath -> Bool Source # (>=) :: BaselinePath -> BaselinePath -> Bool Source # max :: BaselinePath -> BaselinePath -> BaselinePath Source # min :: BaselinePath -> BaselinePath -> BaselinePath Source # | |
IsOption (Maybe BaselinePath) Source # | @since WIP |
Defined in Plutarch.Test.Bench defaultValue :: Maybe BaselinePath parseValue :: String -> Maybe (Maybe BaselinePath) optionName :: Tagged (Maybe BaselinePath) String optionHelp :: Tagged (Maybe BaselinePath) String showDefaultValue :: Maybe BaselinePath -> Maybe String optionCLParser :: Parser (Maybe BaselinePath) |
@since WIP
Instances
Eq CsvPath Source # | @since WIP |
Ord CsvPath Source # | @since WIP |
IsOption (Maybe CsvPath) Source # | @since WIP |
Defined in Plutarch.Test.Bench 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 WIP
Instances
data FailIfLessCpu Source #
@since WIP
Instances
data FailIfMoreMem Source #
@since WIP
Instances
data FailIfLessMem Source #
@since WIP
Instances
data FailIfBigger Source #
@since WIP
Instances
data FailIfSmaller Source #
@since WIP
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 WIP
csvReporter :: Ingredient Source #
@since WIP