[web-devel] [WAI] Switching to WAI/Warp...
spam at scientician.net
Sun Feb 20 11:00:02 CET 2011
On 2011-02-20 10:29, Michael Snoyman wrote:
> On Sun, Feb 20, 2011 at 11:04 AM, Bardur Arantsson<spam at scientician.net> wrote:
>> Is there any way to avoid this extra "fromByteString"?
> blaze-builder is usually pretty intelligent about this. If I remember
> correctly, Simon Meier said that it won't do a memory copy for
> ByteStrings larger than 8k. In any event, if you want to force
> insertion instead of copying, replace fromByteString with
> insertByteString. It *might* be that the CPU overhead is warranted,
> however: you may end up seeing increased system call overhead with
> this switch, since the average chunk size will be smaller.
Good point; I just tried upping the chunk size to 32K and explicitly
using insertByteString. Even with those changes I'm still seeing a lot
of CPU usage (5-10%).
I should say that I'm using a version of the enumFile enumerator from
Data.Enumerator.Binary that I've adapted to support byte ranges. It may
be the case that I've just done something horribly stupid or
inefficient. I've attached the code for the enumerator.
I guess I'll have to try to get some profiling data to see where the
time is actually being spent. I suppose it's about time I learned a bit
about profiling my Haskell code :).
[--snip bits about enumerators--]
Thanks for the explanation. For some reason I'm having a little trouble
"connecting" all the type signatures for enumerator/iterator/iteratee.
Hopefully it'll get better with practice.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 2387 bytes
Desc: not available
More information about the web-devel