1{-# LANGUAGE BangPatterns #-}
2{-# LANGUAGE OverloadedStrings #-}
3{-# LANGUAGE PackageImports #-}
5module Main (main) where
10import "aeson-benchmarks" Data.Aeson
11import Control.Exception
13import Data.Attoparsec.ByteString (IResult(..), parseWith)
15import System.Environment (getArgs)
17import qualified Data.ByteString as B
21 (bs:cnt:args) <- getArgs
22 let count = read cnt :: Int
24 forM_ args $ \arg -> bracket (openFile arg ReadMode) hClose $ \h -> do
26 start <- getCurrentTime
28 | good+bad >= count = return (good, bad)
30 hSeek h AbsoluteSeek 0
31 let refill = B.hGet h blkSize
32 result <- parseWith refill json =<< refill
34 Done _ _ -> loop (good+1) bad
35 _ -> loop good (bad+1)
37 delta <- flip diffUTCTime start `fmap` getCurrentTime
38 putStrLn $ " " ++ show good ++ " good, " ++ show delta
39 let rate = fromIntegral count / realToFrac delta :: Double
40 putStrLn $ " " ++ show (round rate :: Int) ++ " per second"
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list