packages feed

criterion 1.5.13.0 → 1.6.0.0

raw patch · 5 files changed

+57/−26 lines, 5 filesdep ~base-compat-batteriesdep ~criterion-measurementPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: base-compat-batteries, criterion-measurement

API changes (from Hackage documentation)

+ Criterion.Types: [measPeakMbAllocated] :: Measured -> !Int64
- Criterion.Types: Measured :: !Double -> !Double -> !Int64 -> !Int64 -> !Int64 -> !Int64 -> !Int64 -> !Double -> !Double -> !Double -> !Double -> Measured
+ Criterion.Types: Measured :: !Double -> !Double -> !Int64 -> !Int64 -> !Int64 -> !Int64 -> !Int64 -> !Int64 -> !Double -> !Double -> !Double -> !Double -> Measured

Files

Criterion/Main/Options.hs view
@@ -96,27 +96,47 @@              -- ^ Default configuration to use if options are not              -- explicitly specified.           -> Parser Mode-parseWith cfg = config cfg <**> runMode-                -- Important: only run `config` once here, as we only want the-                -- command-line options resulting from `config` to appear once-                -- in the `--help` output. See #168.+parseWith cfg =+  runOrRunIters <|>+  (List <$ switch (long "list" <> short 'l' <> help "List benchmarks")) <|>+  (Version <$ switch (long "version" <> help "Show version info"))   where-    runMode :: Parser (Config -> Mode)-    runMode =-      matchNames (pure $ \mt bs cfg' -> Run cfg' mt bs) <|>-      runIters <|>-      (const List <$ switch (long "list" <> short 'l' <> help "List benchmarks")) <|>-      (const Version <$ switch (long "version" <> help "Show version info"))--    runIters :: Parser (Config -> Mode)-    runIters = matchNames $ (\iters mt bs cfg' -> RunIters cfg' iters mt bs)-      <$> option auto+    runOrRunIters :: Parser Mode+    runOrRunIters =+          -- Because Run and RunIters are separate Modes, it's tempting to+          -- split them out into their own Parsers and choose between them+          -- using (<|>), i.e.,+          --+          --       (Run      <$> config cfg                   <*> ...)+          --   <|> (RunIters <$> config cfg <*> (... "iters") <*> ...)+          --+          -- This is possible, but it has the unfortunate consequence of+          -- invoking the same Parsers (e.g., @config@) multiple times. As a+          -- result, the help text for each Parser would be duplicated when the+          -- user runs --help. See #168.+          --+          -- To avoid this problem, we combine Run and RunIters into a single+          -- Parser that only runs each of its sub-Parsers once. The trick is+          -- to make the Parser for "iters" (the key difference between Run and+          -- RunIters) an optional Parser. If the Parser yields Nothing, select+          -- Run, and if the Parser yields Just, select RunIters.+          --+          -- This is admittedly a bit of a design smell, as the idiomatic way+          -- to handle this would be to turn Run and RunIters into subcommands+          -- rather than options. That way, each subcommand would have its own+          -- --help prompt, thereby avoiding the need to deduplicate the help+          -- text. Unfortunately, this would require breaking the CLI interface+          -- of every criterion-based program, which seems like a leap too far.+          -- The solution used here, while a bit grimy, gets the job done while+          -- keeping Run and RunIters as options.+          (\cfg' mbIters ->+            case mbIters of+              Just iters -> RunIters cfg' iters+              Nothing    -> Run cfg')+      <$> config cfg+      <*> optional (option auto           (long "iters" <> short 'n' <> metavar "ITERS" <>-           help "Run benchmarks, don't analyse")--    matchNames :: Parser (MatchType -> [String] -> Config -> Mode)-               -> Parser (Config -> Mode)-    matchNames wat = wat+           help "Run benchmarks, don't analyse"))       <*> option match           (long "match" <> short 'm' <> metavar "MATCH" <> value Prefix <>            help "How to match benchmark names (\"prefix\", \"glob\", \"pattern\", or \"ipattern\")")
changelog.md view
@@ -1,3 +1,13 @@+1.6.0.0++* `criterion-measurement-0.2.0.0` adds the `measPeakMbAllocated` field to+  `Measured` for reporting maximum megabytes allocated. Since `criterion`+  re-exports `Measured` from `Criterion.Types`, this change affects `criterion`+  as well. Naturally, this affects the behavior of `Measured`'s `{To,From}JSON`+  and `Binary` instances.+* Fix a bug in which the `--help` text for the `--match` option was printed+  twice in `criterion` applications.+ 1.5.13.0  * Allow building with `optparse-applicative-0.17.*`.
criterion.cabal view
@@ -1,5 +1,5 @@ name:           criterion-version:        1.5.13.0+version:        1.6.0.0 synopsis:       Robust, reliable performance measurement and analysis license:        BSD3 license-file:   LICENSE@@ -29,7 +29,7 @@   GHC==8.8.4,   GHC==8.10.7,   GHC==9.0.2,-  GHC==9.2.1+  GHC==9.2.2  data-files:   templates/*.css@@ -84,7 +84,7 @@   build-depends:     -- TODO: Eventually, we should bump the lower version bounds to >=2 so that     -- we can remove some CPP in Criterion.Report. See #247.-    aeson >= 1 && < 2.1,+    aeson >= 1 && < 2.2,     ansi-wl-pprint >= 0.6.7.2,     base >= 4.5 && < 5,     base-compat-batteries >= 0.10 && < 0.13,@@ -94,7 +94,7 @@     cassava >= 0.3.0.0,     code-page,     containers,-    criterion-measurement >= 0.1.1.0 && < 0.2,+    criterion-measurement >= 0.2 && < 0.3,     deepseq >= 1.1.0.0,     directory,     exceptions >= 0.8.2 && < 0.11,@@ -107,7 +107,7 @@     -- TODO: Depend on optparse-applicative-0.17 as the minimum (see #258)     optparse-applicative >= 0.13 && < 0.18,     parsec >= 3.1.0,-    statistics >= 0.14 && < 0.16,+    statistics >= 0.14 && < 0.17,     text >= 0.11,     time,     transformers,
examples/criterion-examples.cabal view
@@ -22,7 +22,7 @@   GHC==8.8.4,   GHC==8.10.7,   GHC==9.0.2,-  GHC==9.2.1+  GHC==9.2.2  flag conduit-vs-pipes   default: True
tests/Tests.hs view
@@ -12,7 +12,7 @@ r1 :: Report r1 = Report 0 "" [] v1 s1 (Outliers 0 0 0 0 0) []  where-  m1 = Measured 4.613000783137977e-05 3.500000000000378e-05 31432 1 0 0 0 0.0 0.0 0.0 0.0+  m1 = Measured 4.613000783137977e-05 3.500000000000378e-05 31432 1 0 0 0 0 0.0 0.0 0.0 0.0   v1 = V.fromList [m1]   est1 = estimateFromErr 0.0 (0.0, 0.0) (mkCL 0.0)   s1 = SampleAnalysis [] est1 est1 (OutlierVariance Unaffected "" 0.0)@@ -24,6 +24,7 @@               , measIters = 1                , measAllocated = minBound+              , measPeakMbAllocated = minBound               , measNumGcs = minBound               , measBytesCopied = minBound