Hi Antoine,<br><br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Can the same technique be ported over to the binary package, or is it<br>
somehow interface incompatible?<br></blockquote><div><br></div><div>I&#39;m not exactly sure what you mean by the same technique. </div><div><br></div><div>If you mean using blaze-builder instead of Data.Binary.Builder as the Monoid that the Put writer monad in the Binary typeclass is using, then, yes, you can because Blaze.ByteString.Builder is a drop-in replacement for Data.Binary.Builder. However, in that case you loose some of the speedup of blaze-builder with respect to Data.Binary.Builder. The results</div>
<div><br></div><div>  <a href="https://gist.github.com/664979#file_comparison_to_binary_package.txt">https://gist.github.com/664979#file_comparison_to_binary_package.txt</a></div><div><br></div><div>of the throughput benchmark (ported from the binary package)</div>
<div><br></div><div>  <a href="https://github.com/meiersi/blaze-builder/blob/master/benchmarks/BenchThroughput.hs">https://github.com/meiersi/blaze-builder/blob/master/benchmarks/BenchThroughput.hs</a></div><div><br></div>
<div>essentially show that you should not use the Put monad but the underlying Monoid directly for serialization. In my opinion, it is also not necessary to have a Writer monad (Put) by default. The only real benefit it brings is the nice do-notation. However, for the syntax we would rather go for a MonoidCatSyntax extension that introduces a &#39;cat&#39; keyword analogously to the &#39;do&#39; keyword. That&#39;s an extension which would also come in very handy for blaze-html and possibly other mappend-heavy applications.</div>
<div><br></div><div>If you mean the Write abstraction, then its a partial yes. You can port it to binary, but I&#39;m not sure how big the win is going to be. The current Data.Binary.Builder implementation suffers the problem that each builder needs to know the strategy for output construction and hence, the whole state of output construction. Passing all that data around makes its `mappend` implementation quite slow.</div>
<div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
I&#39;d thought I&#39;d heard rumbles a while back about a desire the change<br>
the implementation of &#39;binary&#39;, but I don&#39;t know what happened to<br>
that.</blockquote><div><br></div><div>I also heard some rumbles, but nothing concrete. Perhaps one of the &#39;binary&#39; developers could comment on that issue?</div><div><br></div><div>best regards,</div><div>Simon </div>
</div>