[web-devel] ResponseEnumerator
Kazu Yamamoto ( 山本和彦 )
kazu at iij.ad.jp
Tue Dec 13 09:12:54 CET 2011
Hello Michael,
Thank you for your answer.
> Q1. Shouldn't it be at the user's discretion to use Builders
> internally and then create a stream of ByteStrings?
> A1. That would be less efficient, as we wouldn't get cheap
> concatenation with the response headers.
But I guess response headers can be sent by sendMany (i.e. writev())
without concatenation. And if a response body is created, for example,
by enumHandle, the ByteString is large enough. (ByteStrings for a
response body are not concatenated at all, I believe.) So, I'm not
convinced with your answer.
I'm not objecting your design. Rather, I would learn reasons of
your design choice.
Suppose that Builder is more efficient than ByteString in some cases.
Even in this case, it seems to me that the iteratee can be defined as
"Iteratee ByteString IO a" and the iteratee translates ByteString to
Builder (and to ByteString) inside. This design lets programms to omit
"map fromByteString" (e.g. in your Proxy code).
--Kazu
More information about the web-devel
mailing list