File tree Expand file tree Collapse file tree 2 files changed +39
-0
lines changed Expand file tree Collapse file tree 2 files changed +39
-0
lines changed Original file line number Diff line number Diff line change
1
+ {-# LANGUAGE PackageImports #-}
2
+ {-# LANGUAGE ScopedTypeVariables #-}
3
+
4
+ module Main (main ) where
5
+
6
+ import Prelude ()
7
+ import Prelude.Compat
8
+
9
+ import Criterion.Main
10
+ import qualified "aeson-benchmarks" Data.Aeson.Parser.UnescapeFFI as FFI
11
+ import qualified "aeson-benchmarks" Data.Aeson.Parser.UnescapePure as Pure
12
+
13
+ import qualified Data.ByteString.Char8 as BS
14
+
15
+ n :: Int
16
+ n = 10000
17
+
18
+ input :: BS. ByteString
19
+ input = BS. concat $ replicate n $ BS. pack " \\\" "
20
+
21
+ main :: IO ()
22
+ main = defaultMain
23
+ [ bench " ffi" $ whnf FFI. unescapeText input
24
+ , bench " pure" $ whnf Pure. unescapeText input
25
+ ]
Original file line number Diff line number Diff line change @@ -80,6 +80,20 @@ library
80
80
ghc-options : -O2 -Wall
81
81
cpp-options : -DGENERICS
82
82
83
+ executable aeson-benchmark-escape
84
+ main-is : Escape.hs
85
+ hs-source-dirs : ../examples .
86
+ ghc-options : -Wall -O2 -rtsopts
87
+ build-depends :
88
+ aeson-benchmarks,
89
+ base,
90
+ base-compat,
91
+ bytestring,
92
+ criterion >= 1.0 ,
93
+ deepseq,
94
+ ghc-prim,
95
+ text
96
+
83
97
executable aeson-benchmark-compare
84
98
main-is : Compare.hs
85
99
hs-source-dirs : ../examples .
You can’t perform that action at this time.
0 commit comments