On Fri, 30 Mar 2007, Jeremy Shaw wrote:

Hello,

Did you compile with -O2 ? That makes a huge difference when using ByteString.

j.


Ah, that was exactly it. I feel silly.


module Main where

import qualified Data.ByteString.Char8 as B

main = do
   content <- B.readFile "test-text-file"
   let l = length . B.words $ content
   print l


$ ghc -O2 count-b.hs
$ time ./a.out
174372

real    0m0.198s
user    0m0.136s
sys     0m0.012s


Much faster. Thank you!


dino-
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to