1. Bryan O'Sullivan
  2. text

Commits

Bryan O'Sullivan  committed c11e710

Compare Show instance performance

  • Participants
  • Parent commits 30d90bc
  • Branches default

Comments (0)

Files changed (1)

File benchmarks/haskell/Benchmarks/Builder.hs

View file
  • Ignore whitespace
 import Criterion (Benchmark, bgroup, bench, nf)
 import Data.Binary.Builder as B
 import Data.ByteString.Char8 ()
-import Data.Monoid (mconcat)
+import Data.Monoid (mconcat, mempty)
 import qualified Blaze.ByteString.Builder as Blaze
 import qualified Blaze.ByteString.Builder.Char.Utf8 as Blaze
 import qualified Data.ByteString as SB
           flip map numbers $ \m ->
           let n = negate m in
           (bench (show (length (show n))) $ nf (LTB.toLazyText . Int.decimal) n)
+        , bench "Empty" $ nf LTB.toLazyText mempty
+        , bgroup "Show" .
+          flip map numbers $ \n ->
+          (bench (show (length (show n))) $ nf show n)
         ]
       ]
     ]