Skip to content
Snippets Groups Projects
Commit 8a402c1d authored by bos's avatar bos
Browse files

Compare Show instance performance

parent 4869d2ee
No related branches found
No related tags found
No related merge requests found
......@@ -12,7 +12,7 @@ module Benchmarks.Builder
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
......@@ -44,6 +44,10 @@ benchmark = return $ bgroup "Builder"
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)
]
]
]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment