Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove annoying error message #5956

Merged
merged 2 commits into from
May 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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