1{-# LANGUAGE BangPatterns, OverloadedStrings #-}
3import Control.Exception
6import Data.Aeson.Encode
7import Data.Aeson.Parser
10import System.Environment (getArgs)
12import qualified Data.ByteString as B
13import qualified Data.ByteString.Lazy as L
14import qualified Data.ByteString.Lazy.Internal as L
17instance NFData L.ByteString where
19 where go (L.Chunk _ cs) = go cs
25 let count = read cnt :: Int
26 forM_ args $ \arg -> bracket (openFile arg ReadMode) hClose $ \h -> do
28 let refill = B.hGet h 16384
29 result <- parseWith refill json =<< refill
32 _ -> fail $ "failed to read " ++ show arg
33 start <- getCurrentTime
35 | n >= count = return ()
36 | otherwise = {-# SCC "loop" #-} do
38 Done _ r -> rnf (encode r) `seq` loop (n+1) r
39 _ -> error $ "failed to read " ++ show arg
41 delta <- flip diffUTCTime start `fmap` getCurrentTime
42 let rate = fromIntegral count / (fromRational . toRational) delta :: Double
43 putStrLn $ " " ++ show delta
44 putStrLn $ " " ++ show (round rate) ++ " 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