[Haskell-cafe] Data.Binary and error handling

Alexey Khudyakov alexey.skladnoy at gmail.com
Thu Dec 3 17:41:25 EST 2009


On Fri, Nov 27, 2009 at 10:36 PM, Mark Lentczner <markl at glyphic.com> wrote:
> I'm in the same quandary:
>
> Data.Binary from the binary package has no error handling
> Data.Serialize from the cereal package uses only strict ByteString
>
> I was going to add error handling to Binary as a weekend project (it isn't that hard), but when I contacted the developers of binary, I was pointed at cereal. But as my project can parse multi-megabyte objects off the wire, I really want lazy ByteString support.
>
> I understand from the cereal creators that lazy ByteStrings are not in the future of cereal, since they got a big speed boost by going to strict ByteStrings only.
>
> I understand that Bryan O'Sullivan might have done work on adding errors to Binary... Bryan? If that's available, can we get it? If not, shall I do the work to add error handling?  It's a long weekend... I've got time!
>
As an experiment I ported error handling from cereal to binary. It
does work, passes all tests shipped
with binary. Perfomance became worse. According to benchmarks shipped
with binary I observed ~25%
perfomance drop. However when I ported my program I have 40% speedup.
I think it's because I removed
code which work around lack error handling and replaced with error
handling in Get monad

As for strictess concerns. Patch doesn't seem to change strictess from
current state. At least my program
which uses very big inputs works without any changes.

Comments and suggestions are welcome
-------------- next part --------------
A non-text attachment was scrubbed...
Name: binary-errors.patch
Type: text/x-patch
Size: 4524 bytes
Desc: not available
Url : http://www.haskell.org/pipermail/haskell-cafe/attachments/20091203/9085a836/binary-errors.bin


More information about the Haskell-Cafe mailing list