
28 Feb
2013
28 Feb
'13
4:22 a.m.
On 2/27/13 2:17 AM, Vincent Hanquez wrote:
Two major problems of lazy bytestrings is that:
* you can't pass it to a C bindings easily. * doing IO with it without rewriting the chunks, can sometimes (depending how the lazy bytestring has been produced) result in a serious degradation of performance calling syscalls on arbitrary and small chunks (e.g. socket's 'send').
If you're on a POSIX system, you can always make use of unix-bytestring[1]. In particular, for lazy ByteStrings the function you want is System.Posix.IO.ByteString.Lazy.fdWritev which performs a single syscall to write all the chunks, and without manually concatenating them. [1] http://hackage.haskell.org/package/unix-bytestring -- Live well, ~wren