Binary: Put -> Builder
Chris Kuklewicz
haskell at list.mightyreason.com
Thu Feb 12 18:45:03 EST 2009
Don Stewart wrote:
> OK. I'm preparing the 0.5 release of binary atm, so will expose these.
>
> -- Don
Don: I had proposed (with a patch) to let the caller of runPut give a size hint
so the first chunk allocated for the Lazy ByteString would not have to always be
the default value (which I remember being about 32 kilo bytes). If the first
allocation filled up the subsequent chunks are still the default size.
My use case was for the protocol-buffers package where the serialized message
sizes are both known in advance and often much much smaller than this. I have
no benchmarks, but it feels wrong to have my library constantly over-allocating.
Is such a feature going to be accepted into the binary package? If not then I
may just copy over and patch the Put monad. (I do not use an external Get
monad, the protocol-buffers package includes its own Get monad).
Cheers,
Chris
More information about the Libraries
mailing list