[Haskell-cafe] Attoparsec concatenating combinator

Bryan O'Sullivan bos at serpentine.com
Tue Jun 7 17:09:50 CEST 2011


On Tue, Jun 7, 2011 at 1:40 AM, Simon Meier <iridcode at gmail.com> wrote:

> Why would you need 'unsafePerformIO'. You can scrutinise the 'PS'
> constructors of the slice without dropping down to IO.


True. Oops :-)


> Using a Builder for concatentation makes sense, if you want to exploit
> that copying a slice of the input array is cheaper right after it has
> been inspected (its fully cached) than later (as it is done when
> collecting slices in a list).


When I've measured this in the past, I've found that it's often faster to
accumulate a list and then run concat at the end than to use blaze-builder
directly. That was certainly the case wit GHC 6.12; I haven't remeasured
with 7.0. That's why you'll see that some places in the aeson JSON library
use blaze-builder, while others manipulate bytestrings directly.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20110607/f92c3ac1/attachment-0001.htm>


More information about the Haskell-Cafe mailing list