Commits

Jasper Van der Jeugt committed fb053c8

Clean up FoldLines benchmark a bit

Comments (0)

Files changed (1)

tests/benchmarks/src/Data/Text/Benchmarks/FoldLines.hs

--- | Fold over the lines in a file
+-- | Read a file line-by-line using handles, and perform a fold over the lines.
+-- The fold is used here to calculate the number of lines in the file.
 --
 {-# LANGUAGE BangPatterns #-}
 module Data.Text.Benchmarks.FoldLines
 import qualified Data.Text.IO as T
 
 benchmark :: FilePath -> IO Benchmark
-benchmark fp = return $ bgroup "FoldLines"
-    [ bench "Text" $ withHandle $ foldLinesT (\n _ -> n + 1) (0 :: Int)
+benchmark fp = return $ bgroup "ReadLines"
+    [ bench "Text" $       withHandle $ foldLinesT (\n _ -> n + 1) (0 :: Int)
     , bench "ByteString" $ withHandle $ foldLinesB (\n _ -> n + 1) (0 :: Int)
     ]
   where
         hClose h
         return x
 
--- Text line fold
+-- | Text line fold
 --
 foldLinesT :: (a -> T.Text -> a) -> a -> Handle -> IO a
 foldLinesT f z0 h = go z0
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.