[Haskell-cafe] performance difference for binary- with ghc-6.8.3 and ghc-6.10

John Lato jwlato at gmail.com
Sun Oct 26 12:36:22 EDT 2008


I was experimenting with using ghc- on a project, and
it seems that binary- has markedly worse performance in certain
cases.  With the following simple test:

> import qualified Data.ByteString.Lazy as L
> import Data.Binary
> import Data.Binary.Get
> import Control.Monad
> main :: IO ()
> main = do
>     b <- L.readFile "some_binary_file"
>     putStrLn $ show $ runGet getter b

> getter :: Get [Word16]
> getter = replicateM 1000000 getWord16le

running this program compiled with ghc-6.10 takes about 4 times as
long (and consumes much more memory) as when compiled with ghc-6.8.3.
The extra time appears to be proportional to the number of elements
processed in the Get.  Running the programs with -hT shows a clear
memory difference, which I think is the source of the problem.  I've
placed pdfs of that output at https://webspace.utexas.edu/latojw/data/

The difference seems to manifest itself only when the elements are
actually processed; changing "show $ runGet " to "show $ length $
runGet " is slightly faster in 6.10.

I was working on an Intel Mac with OS 10.4, binary-, and
bytestring-  Can anyone confirm this, or suggest what might be
the difference?

Thank you,
John Lato

More information about the Haskell-Cafe mailing list