Permalink
Browse files

Vary block size when parsing

  • Loading branch information...
bos committed Jan 31, 2013
1 parent aaed056 commit 21029726b45073e8b7a5cc2af664e2ce850c2e92
Showing with 3 additions and 2 deletions.
  1. +3 −2 benchmarks/AesonParse.hs
View
@@ -10,16 +10,17 @@ import System.IO
import qualified Data.ByteString as B
main = do
- (cnt:args) <- getArgs
+ (bs:cnt:args) <- getArgs
let count = read cnt :: Int
+ blkSize = read bs
forM_ args $ \arg -> bracket (openFile arg ReadMode) hClose $ \h -> do
putStrLn $ arg ++ ":"
start <- getCurrentTime
let loop !good !bad
| good+bad >= count = return (good, bad)
| otherwise = do
hSeek h AbsoluteSeek 0
- let refill = B.hGet h 16384
+ let refill = B.hGet h blkSize
result <- parseWith refill json =<< refill
case result of
Done _ r -> loop (good+1) bad

0 comments on commit 2102972

Please sign in to comment.