criterion 1.5.11.0 → 1.5.12.0
raw patch · 5 files changed
+46/−13 lines, 5 filesdep ~statisticsPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: statistics
API changes (from Hackage documentation)
Files
- Criterion/Report.hs +19/−12
- changelog.md +5/−0
- criterion.cabal +1/−1
- examples/Quotes.hs +12/−0
- examples/criterion-examples.cabal +9/−0
Criterion/Report.hs view
@@ -113,14 +113,26 @@ -- the <script> tag from within the JSON data is disallowed, i.e, the character -- sequence "</" is made impossible. ----- Moreover, single quotes are escaped such that embedding JSON into HTML--- attributes quoted with single quotes is safe, & is escaped to avoid HTML--- character references (&<code>;) and + is escaped to avoid UTF-7 attacks--- (should only affect old versions of IE).+-- Moreover, & is escaped to avoid HTML character references (&<code>;), + is+-- escaped to avoid UTF-7 attacks (should only affect old versions of IE), and+-- \0 is escaped to allow it to be represented in JSON, as the NUL character is+-- disallowed in JSON but valid in Haskell characters. ----- The following characters are replaced with their unicode escape sequnces--- (\uXXXX) <, >, &, +, \0, \n, \r, ' (single quote), /, \, \x2028 (line--- separator) and \x2029 (paragraph separator)+-- The following characters are replaced with their unicode escape sequences+-- (\uXXXX):+-- <, >, &, +, \x2028 (line separator), \x2029 (paragraph separator), and \0+-- (null terminator)+--+-- Other characters are such as \\ (backslash) and \n (newline) are not escaped+-- as the JSON serializer @encodeToLazyText@ already escapes them when they+-- occur inside JSON strings and they cause no issues with respect to HTML+-- safety when used outside of strings in the JSON-encoded payload.+--+-- If the resulting JSON-encoded Text is embedded in an HTML attribute, extra+-- care is required to also escape quotes with character references in the+-- final JSON payload.+-- See <https://html.spec.whatwg.org/multipage/syntax.html#syntax-attributes>+-- for details on how to escape attribute values. escapeJSON :: Char -> TL.Text escapeJSON '<' = "\\u003c" -- ban closing of the script tag by making </ impossible escapeJSON '>' = "\\u003e" -- encode tags with unicode escape sequences@@ -129,11 +141,6 @@ escapeJSON '&' = "\\u0026" -- avoid HTML entities escapeJSON '+' = "\\u002b" -- + can be used in UTF-7 escape sequences escapeJSON '\0' = "\\u0000" -- make null characters explicit-escapeJSON '\n' = "\\u000a" -- for good measure also escape newlines-escapeJSON '\r' = "\\u000d" -- , carriage returns-escapeJSON '\'' = "\\u0027" -- , single quotes-escapeJSON '/' = "\\u002f" -- , slashes-escapeJSON '\\' = "\\u005c" -- , and backslashes escapeJSON c = TL.singleton c -- | Format a series of 'Report' values using the given Mustache template.
changelog.md view
@@ -1,3 +1,8 @@+1.5.12.0++* Fix a bug introduced in version 1.5.9.0 in which benchmark names that include+ double quotes would produce broken HTML reports.+ 1.5.11.0 * Allow building with `aeson-2.0.0.0`.
criterion.cabal view
@@ -1,5 +1,5 @@ name: criterion-version: 1.5.11.0+version: 1.5.12.0 synopsis: Robust, reliable performance measurement and analysis license: BSD3 license-file: LICENSE
+ examples/Quotes.hs view
@@ -0,0 +1,12 @@+module Main where++import Criterion+import Criterion.Main++main :: IO ()+main = defaultMain+ [ env (return ()) $+ \ ~() -> bgroup "\"oops\"" [bench "dummy" $ nf id ()]+ , env (return ()) $+ \ ~() -> bgroup "'oops'" [bench "dummy" $ nf id ()]+ ]
examples/criterion-examples.cabal view
@@ -112,6 +112,15 @@ criterion, optparse-applicative +executable quotes+ main-is: Quotes.hs++ default-language: Haskell2010+ ghc-options: -Wall -rtsopts+ build-depends:+ base == 4.*,+ criterion+ -- Cannot uncomment due to https://github.com/haskell/cabal/issues/1725 -- -- executable judy