1-- | Benchmarks simple file reading
3-- Tested in this benchmark:
5-- * Reading a file from the disk
7module Benchmarks.FileRead
11import Control.Applicative ((<$>))
12import Criterion (Benchmark, bgroup, bench, whnfIO)
13import qualified Data.ByteString as SB
14import qualified Data.ByteString.Lazy as LB
15import qualified Data.Text as T
16import qualified Data.Text.Encoding as T
17import qualified Data.Text.IO as T
18import qualified Data.Text.Lazy as LT
19import qualified Data.Text.Lazy.Encoding as LT
20import qualified Data.Text.Lazy.IO as LT
22benchmark :: FilePath -> IO Benchmark
23benchmark p = return $ bgroup "FileRead"
24 [ bench "String" $ whnfIO $ length <$> readFile p
25 , bench "ByteString" $ whnfIO $ SB.length <$> SB.readFile p
26 , bench "LazyByteString" $ whnfIO $ LB.length <$> LB.readFile p
27 , bench "Text" $ whnfIO $ T.length <$> T.readFile p
28 , bench "LazyText" $ whnfIO $ LT.length <$> LT.readFile p
29 , bench "TextByteString" $ whnfIO $
30 (T.length . T.decodeUtf8) <$> SB.readFile p
31 , bench "LazyTextByteString" $ whnfIO $
32 (LT.length . LT.decodeUtf8) <$> LB.readFile p
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