This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "snap-core".
The branch, master has been updated
via 0ddeb8017bebbbd7833b902940084c51bdec0a8f (commit)
from feb031cf26a63e33e5d5514288c25460c83bf11f (commit)
Summary of changes:
src/Snap/Iteratee.hs | 14 +++++++++-----
1 files changed, 9 insertions(+), 5 deletions(-)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 0ddeb8017bebbbd7833b902940084c51bdec0a8f
Author: Gregory Collins <[email protected]>
Date: Mon May 24 08:36:07 2010 -0400
Improve enumLBS performance
diff --git a/src/Snap/Iteratee.hs b/src/Snap/Iteratee.hs
index 23fa0cb..69b6fda 100644
--- a/src/Snap/Iteratee.hs
+++ b/src/Snap/Iteratee.hs
@@ -107,11 +107,11 @@ countBytes = go 0
--
-- Our enumerators produce a lot of little strings; rather than spending all
-- our time doing kernel context switches for 4-byte write() calls, we buffer
--- the iteratee to send 2KB at a time.
+-- the iteratee to send 8KB at a time.
bufferIteratee :: (Monad m) => Enumerator m a
bufferIteratee = return . go (D.empty,0)
where
- blocksize = 2048
+ blocksize = 8192
--go :: (DList ByteString, Int) -> Iteratee m a -> Iteratee m a
go (!dl,!n) iter = IterateeG $! f (dl,n) iter
@@ -154,10 +154,14 @@ enumBS bs = enumPure1Chunk $ WrapBS bs
------------------------------------------------------------------------------
-- | Enumerates a lazy bytestring.
enumLBS :: (Monad m) => L.ByteString -> Enumerator m a
-enumLBS lbs iter = foldM k iter enums
+enumLBS lbs = el chunks
where
- enums = map (enumPure1Chunk . WrapBS) $ L.toChunks lbs
- k i e = e i
+ el [] i = return i
+ el (x:xs) i = do
+ i' <- enumBS x i
+ el xs i'
+
+ chunks = L.toChunks lbs
------------------------------------------------------------------------------
-----------------------------------------------------------------------
hooks/post-receive
--
snap-core
_______________________________________________
Snap mailing list
[email protected]
http://mailman-mail5.webfaction.com/listinfo/snap