on 0.11.1.2 help sign in
18 lines 539 B history raw
1module Main (main) where
3import Criterion.Main
4import qualified Data.Aeson.Encode.Builder as AB
5import qualified Data.ByteString.Builder as B
6import qualified Data.Text as T
9main :: IO ()
10main = do
11 let txt = "append (append b (primBounded w1 x1)) (primBounded w2 x2)"
12 defaultMain [
13 bgroup "string" [
14 bench "text" $ nf (B.toLazyByteString . AB.text) (T.pack txt)
15 , bench "string direct" $ nf (B.toLazyByteString . AB.string) txt
16 , bench "string via text" $ nf (B.toLazyByteString . AB.text . T.pack) txt
17 ]
18 ]