diff --git a/plutus-core/cost-model/budgeting-bench/Benchmarks/Strings.hs b/plutus-core/cost-model/budgeting-bench/Benchmarks/Strings.hs index 8025447052e..93c0b5a8d8f 100644 --- a/plutus-core/cost-model/budgeting-bench/Benchmarks/Strings.hs +++ b/plutus-core/cost-model/budgeting-bench/Benchmarks/Strings.hs @@ -147,11 +147,9 @@ benchTwoTextStrings name = s2 = makeSizedTextStrings seedB twoArgumentSizes in createTwoTermBuiltinBench name [] s1 s2 - -- Benchmark times for a function applied to equal arguments. This is used for --- benchmarking EqualsString on the diagonal. --- Copy the bytestring here, because otherwise it'll be exactly the same and --- the equality will short-circuit. +-- benchmarking EqualsString on the diagonal. Copy the string here, because +-- otherwise it'll be exactly the same and the equality will short-circuit. benchSameTwoTextStrings :: DefaultFun -> Benchmark benchSameTwoTextStrings name = createTwoTermBuiltinBenchElementwise name [] inputs (fmap T.copy inputs) diff --git a/plutus-core/cost-model/budgeting-bench/CriterionExtensions.hs b/plutus-core/cost-model/budgeting-bench/CriterionExtensions.hs index ba349446ec5..d3b89093e98 100644 --- a/plutus-core/cost-model/budgeting-bench/CriterionExtensions.hs +++ b/plutus-core/cost-model/budgeting-bench/CriterionExtensions.hs @@ -2,7 +2,6 @@ module CriterionExtensions (criterionMainWith, BenchmarkingPhase(..)) where -import Control.Monad (unless) import Control.Monad.Trans (liftIO) import Criterion.Internal (runAndAnalyse, runFixedIters) import Criterion.IO.Printf (printError, writeCsv) @@ -83,21 +82,23 @@ criterionMainWith phase defCfg bs = RunIters cfg iters matchType benches -> withConfig cfg $ do () <- initCsvFile phase cfg - shouldRun <- liftIO $ selectBenches matchType benches bsgroup + shouldRun <- liftIO $ selectBenches matchType benches runFixedIters iters shouldRun bsgroup Run cfg matchType benches -> withConfig cfg $ do () <- initCsvFile phase cfg - shouldRun <- liftIO $ selectBenches matchType benches bsgroup + shouldRun <- liftIO $ selectBenches matchType benches liftIO initializeTime runAndAnalyse shouldRun bsgroup where bsgroup = BenchGroup "" bs -selectBenches :: MatchType -> [String] -> Benchmark -> IO (String -> Bool) -selectBenches matchType benches bsgroup = do +-- Select the benchmarks to be run. If a pattern is specified on the command +-- line then only the matching benchmarks will be run. If there are no matching +-- benchmarks then the command will stil succeed (with no error or warning), but +-- nothing will be benchmarked. +selectBenches :: MatchType -> [String] -> IO (String -> Bool) +selectBenches matchType benches = do toRun <- either parseError return . makeMatcher matchType $ benches - unless (null benches || any toRun (benchNames bsgroup)) $ - parseError "none of the specified names matches a benchmark" return toRun parseError :: String -> IO a diff --git a/plutus-core/cost-model/budgeting-bench/Main.hs b/plutus-core/cost-model/budgeting-bench/Main.hs index 7571b534e2a..353232d1a21 100644 --- a/plutus-core/cost-model/budgeting-bench/Main.hs +++ b/plutus-core/cost-model/budgeting-bench/Main.hs @@ -61,11 +61,6 @@ main = do {- Run the nop benchmarks with a large time limit (30 seconds) in an attempt to get accurate results. -} - -- FIXME: this doesn't quite work. If you specify a benchmark name on the - -- command line and it's in the first group then it'll run but you'll get an - -- error when the argument gets passed to the nop benchmarks below (but the - -- data will still be generated and saved in benching.csv). - criterionMainWith Continue (defaultConfig { C.timeLimit = 30 }) $