criterion 1.5.3.0 → 1.5.4.0
raw patch · 7 files changed
+80/−8 lines, 7 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Criterion.Main.Options: describeWith :: Parser a -> ParserInfo a
Files
- Criterion/Main/Options.hs +7/−2
- README.markdown +1/−1
- changelog.md +18/−0
- criterion.cabal +2/−2
- examples/ExtensibleCLI.hs +38/−0
- examples/criterion-examples.cabal +11/−1
- templates/default.tpl +3/−2
Criterion/Main/Options.hs view
@@ -19,6 +19,7 @@ , parseWith , config , describe+ , describeWith , versionInfo ) where @@ -194,9 +195,13 @@ let ret = (words . map repl . drop 1 $ ps, tidy r) either readerError (const (return ret)) $ uncurry validateAccessors ret --- | Flesh out a command line parser.+-- | Flesh out a command-line parser. describe :: Config -> ParserInfo Mode-describe cfg = info (helper <*> parseWith cfg) $+describe cfg = describeWith $ parseWith cfg++-- | Flesh out command-line information using a custom 'Parser'.+describeWith :: Parser a -> ParserInfo a+describeWith parser = info (helper <*> parser) $ header ("Microbenchmark suite - " <> versionInfo) <> fullDesc <> footerDoc (unChunk regressionHelp)
README.markdown view
@@ -5,7 +5,7 @@ This package provides the Criterion module, a Haskell library for measuring and analysing software performance. -<a href="http://www.serpentine.com/criterion/fibber.html" target="_blank"><img src="http://www.serpentine.com/criterion/fibber-screenshot.png"></img></a>+<a href="http://www.serpentine.com/criterion/fibber.html" target="_blank"><img src="www/fibber-screenshot.png"></a> To get started, read the <a href="http://www.serpentine.com/criterion/tutorial.html"
changelog.md view
@@ -1,3 +1,21 @@+1.5.4.0++* Add `parserWith`, which allows creating a `criterion` command-line interface+ using a custom `optparse-applicative` `Parser`. This is usefule for sitations+ where one wants to add additional command-line arguments to the default ones+ that `criterion` provides.++ For an example of how to use `parserWith`, refer to+ `examples/ExtensibleCLI.hs`.++* Tweak the way the graph in the HTML overview zooms:++ * Zooming all the way out resets to the default view (instead of continuing+ to zoom out towards empty space).+ * Panning all the way to the right resets to the default view in which zero+ is left-aligned (instead of continuing to pan off the edge of the graph).+ * Panning and zooming only affecs the x-axis, so all results remain in-frame.+ 1.5.3.0 * Make more functions (e.g., `runMode`) able to print the `µ` character on
criterion.cabal view
@@ -1,5 +1,5 @@ name: criterion-version: 1.5.3.0+version: 1.5.4.0 synopsis: Robust, reliable performance measurement and analysis license: BSD3 license-file: LICENSE@@ -25,7 +25,7 @@ GHC==8.0.2, GHC==8.2.2, GHC==8.4.4,- GHC==8.6.2+ GHC==8.6.3 data-files: templates/*.css
+ examples/ExtensibleCLI.hs view
@@ -0,0 +1,38 @@+module Main where++import Criterion.Main+import Criterion.Main.Options+import Options.Applicative+import Prelude ()+import Prelude.Compat++data CustomArgs = CustomArgs+ { -- This data type adds two new arguments, listed below.+ customArg1 :: Int+ , customArg2 :: String++ -- The remaining arguments come from criterion itself.+ , criterionArgs :: Mode+ }++customParser :: Parser CustomArgs+customParser = CustomArgs+ <$> option auto+ ( long "custom-arg1"+ <> value 42+ <> metavar "INT"+ <> help "Custom argument 1" )+ <*> strOption+ ( long "custom-arg2"+ <> value "Benchmark name"+ <> metavar "STR"+ <> help "Custom argument 2" )+ <*> parseWith defaultConfig++main :: IO ()+main = do+ args <- execParser $ describeWith customParser+ putStrLn $ "custom-arg1: " ++ show (customArg1 args)+ putStrLn $ "custom-arg2: " ++ customArg2 args+ runMode (criterionArgs args)+ [ bench (customArg2 args) $ whnf id $ customArg1 args ]
examples/criterion-examples.cabal view
@@ -18,7 +18,7 @@ GHC==8.0.2, GHC==8.2.2, GHC==8.4.4,- GHC==8.6.2+ GHC==8.6.3 flag conduit-vs-pipes default: True@@ -91,6 +91,16 @@ build-depends: base == 4.*, criterion++executable extensible-cli+ main-is: ExtensibleCLI.hs++ ghc-options: -Wall -rtsopts+ build-depends:+ base == 4.*,+ base-compat-batteries,+ criterion,+ optparse-applicative -- Cannot uncomment due to https://github.com/haskell/cabal/issues/1725 --
templates/default.tpl view
@@ -317,10 +317,11 @@ max_time = Math.max(max_time, means[0][i] + stddevs[i]); } var oq = $("#overview");+ var max_x = max_time * 1.02; o = $.plot(oq, xs, { grid: { borderColor: "#777", hoverable: true }, legend: { show: xs.length > 1 },- xaxis: { max: max_time * 1.02 },- yaxis: { ticks: ylabels, tickColor: '#ffffff' },+ xaxis: { max: max_x, zoomRange: [false, max_x], panRange: [0, max_x] },+ yaxis: { ticks: ylabels, tickColor: '#ffffff', zoomRange: false, panRange: false }, zoom: { interactive: true, amount: 1.05 }, pan: { interactive: true } }); if (benches.length > 3)