[Haskell-cafe] two problems with Data.Binary and Data.ByteString

Don Stewart dons at galois.com
Tue Aug 12 20:47:14 EDT 2008


bos:
> On Tue, Aug 12, 2008 at 5:13 PM, Tim Newsham <newsham at lava.net> wrote:
> 
> > The data type I'm storing is a Map (of maps):
> >
> >   type DailyDb = M.Map Date Daily
> >   type InstrsDb = M.Map String DailyDb
> >
> > What's going on here?
> 
> The default marshalling scheme that Binary uses for lists and maps
> (which are flattened to lists before writing out) is not streamable.
> Instead of writing out data in chunks, it computes the length of the
> list and writes that, followed by the elements. Presumably on the read
> side, a huge thunk is being built up before any actual Map creation
> starts.

Maybe it makes sense to have the streamble list instance in Binary as
well, with some examples?

-- Don


More information about the Haskell-Cafe mailing list