[Haskell-cafe] The state of binary (de)serialization
Vincent Hanquez
tab at snarc.org
Wed Feb 27 08:17:49 CET 2013
On Mon, Feb 25, 2013 at 11:59:42AM -0800, Johan Tibell wrote:
> > - cereal can output a strict bytestring (runPut) or a lazy one
> > (runPutLazy), whilst binary only outputs lazy ones (runPut)
> >
>
> The lazy one is more general and you can use toStrict (from bytestring) to
> get a strict ByteString from a lazy one, without loss of performance.
Two major problems of lazy bytestrings is that:
* you can't pass it to a C bindings easily.
* doing IO with it without rewriting the chunks, can sometimes (depending
how the lazy bytestring has been produced) result in a serious degradation of
performance calling syscalls on arbitrary and small chunks (e.g. socket's 'send').
Personally, i also like the (obvious) stricter behavior of strict bytestring.
--
Vincent
More information about the Haskell-Cafe
mailing list