[Haskell-cafe] Data.Binary poor read performance
Neil Mitchell
ndmitchell at gmail.com
Mon Feb 23 13:43:47 EST 2009
Hi,
In an application I'm writing with Data.Binary I'm seeing very fast
write performance (instant), but much slower read performance. Can you
advise where I might be going wrong?
The data type I'm serialising is roughly: Map String [Either
(String,[String]) [(String,Int)]]
A lot of the String's are likely to be identical, and the end file
size is 1Mb. Time taken with ghc -O2 is 0.4 seconds.
Various questions/thoughts I've had:
1) Is reading a lot slower than writing by necessity?
2) The storage for String seems to be raw strings, which is nice.
Would I get a substantial speedup by moving to bytestrings instead of
strings? If I hashed the strings and stored common ones in a hash
table is it likely to be a big win?
3) How long might you expect 1Mb to take to read?
Thanks for the library, its miles faster than the Read/Show I was
using before - but I'm still hoping that reading 1Mb of data can be
instant :-)
Thanks
Neil
More information about the Haskell-Cafe
mailing list