[Haskell-cafe] Re: Over-allocation

Don Stewart dons at galois.com
Sat Dec 8 16:43:26 EST 2007


gracjanpolak:
> Gracjan Polak <gracjanpolak <at> gmail.com> writes:
> 
> > 
> > Don Stewart <dons <at> galois.com> writes:
> > > 
> > > ByteStrings have all the same operations as lists though, so you can
> > > index, compare and take substrings, with the benefit that he underlying
> > > string will be shared, not copied. And only use 1 byte per element.
> > 
> > Is there any parser built directly over ByteString that I could look at?
> > 
> > Or maybe somebody implemented something like Text.ParserCombinators.ReadP for
> > ByteString?
> > 
> > >From the first sight it seems doable, so there is light at the end of the 
> > tunnel :)
> > 
> 
> Just a success report, after 58 min of coding I got kind of ReadP parser over
> ByteString working and my memory usage went down from 1500MB to... 1.2MB! Over
> 1000 times better! Incredible!
> 
> Thanks for the suggestion to do it with ByteStrings!
> 
> I hope to publish it when I clean it up enough!

That is really awesome!
Sharing input strings around with bytestrings really should lead to
excellent memory savings in parsing. I'm glad we see this confirmed.

Will you be releasing the code soon?

-- Don


More information about the Haskell-Cafe mailing list