[Haskell-cafe] Attoparsec concatenating combinator

Yitzchak Gale gale at sefer.org
Sun Jun 5 20:00:06 CEST 2011


I wrote:
>> I was thinking of even lower level: allocating a moderate chunk of
>> memory and writing the results directly into it consecutively as a
>> special case.

Bryan O'Sullivan wrote:
> Surely that would save only one copy compared to creating a list of results
> and then concatenating them, no? I'd be a little surprised if it proved
> worthwhile.

If behind the scenes the concat is copying directly from slices of the original
input, then no, in principle we're not saving much then.
I thought there were *two* copies going on.

It might be possible to keep the byte count only in the special
case of a concatenating combinator, but that would require
some work to implement.

Thanks as usual for the fantastic work,
Yitz



More information about the Haskell-Cafe mailing list