Skip to content

Commit

Permalink
Remove annoying error message (#5956)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kenneth MacKenzie authored May 4, 2024
1 parent 619ddbc commit 067e74f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 16 deletions.
6 changes: 2 additions & 4 deletions plutus-core/cost-model/budgeting-bench/Benchmarks/Strings.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
15 changes: 8 additions & 7 deletions plutus-core/cost-model/budgeting-bench/CriterionExtensions.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down
5 changes: 0 additions & 5 deletions plutus-core/cost-model/budgeting-bench/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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 }) $
Expand Down

0 comments on commit 067e74f

Please sign in to comment.