On Tue, Jun 7, 2011 at 1:40 AM, Simon Meier <iridcode@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.