Adding binary to the Haskell Platform
Don Stewart
dons at galois.com
Wed Aug 5 10:41:28 EDT 2009
malcolm.wallace:
>> Let's discuss, then have the steering committee recommend yay/nay.
>
> We should have _some_ kind of binary library in the Platform, but I
> don't know whether the proposed library is the right one.
>
> In a recent application, I found Data.Binary very slow, both to encode
> and to decode data. Decoding had stack-overflows, and when I increased
> the stack, it took about 20mins to read in an 8Mb file. When I then
> turned on optimisation with -O, the performance improved considerably
> (down to ~30secs to read the same file). This was using the standard
> instances of Binary for data structures like Data.Map. 30secs was still
> too slow, so we ended up needing to write our own improved instance for
> Data.Map. (Timings were similar with both ghc-6.8.3 and ghc-6.10.3.)
I don't think I've ever benchmarked without optimizations.
Unfortunately, as Data.Map is exported abstractly, we can't use the
internal folds as we do for the Data.Sequence instance.
Can you submit your improved Map instance?
In general, Data.Binary is heavily optimized for the underlying Get/Put
monads, but instances for different data types are just straight forward
implementations (which seems to be what people complain about the most:
very large lists (in the past) and very large Data.Maps).
-- Don
More information about the Libraries
mailing list