File tree Expand file tree Collapse file tree 1 file changed +13
-7
lines changed Expand file tree Collapse file tree 1 file changed +13
-7
lines changed Original file line number Diff line number Diff line change @@ -11,15 +11,21 @@ import qualified "aeson-benchmarks" Data.Aeson.Parser.UnescapeFFI as FFI
11
11
import qualified "aeson-benchmarks" Data.Aeson.Parser.UnescapePure as Pure
12
12
13
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 " \\\" "
14
+ import System.Environment (getArgs , withArgs )
20
15
21
16
main :: IO ()
22
- main = defaultMain
17
+ main = do
18
+ args_ <- getArgs
19
+ let (args, p, n) =
20
+ case args_ of
21
+ " --pattern" : p : args_ -> k p args_
22
+ _ -> k " \\\" " args_
23
+ k p args_ =
24
+ case args_ of
25
+ " --repeat" : n : args_ -> (args_, p, read n)
26
+ args_ -> (args_, p, 10000 )
27
+ input = BS. concat $ replicate n $ BS. pack p
28
+ withArgs args $ defaultMain
23
29
[ bench " ffi" $ whnf FFI. unescapeText input
24
30
, bench " pure" $ whnf Pure. unescapeText input
25
31
]
You can’t perform that action at this time.
0 commit comments