Permalink
Browse files

removed left-over flag -fno-warn-unused-binds in .cabal file

  - version bump and added copyright year 2011
  • Loading branch information...
1 parent ee08e47 commit 86d219afab3095728f9235e7040254e0ff29948d @meiersi committed Jan 26, 2011
Showing with 77 additions and 8 deletions.
  1. +4 −0 CHANGES
  2. +65 −0 bench/pure-enum.hs
  3. +8 −8 blaze-builder-enumerator.cabal
View
@@ -1,3 +1,7 @@
+* blaze-builder-enumerator-0.2.0.1
+
+ Removed left-over flag -fno-warn-unused-binds in .cabal file to allow
+ blaze-builder-enumerator to be built with GHC 6.10.
* blaze-builder-enumerator-0.2.0.0
View
@@ -0,0 +1,65 @@
+{-# LANGUAGE OverloadedStrings #-}
+import Criterion.Main
+import Blaze.ByteString.Builder
+import Blaze.ByteString.Builder.Char8
+import Blaze.ByteString.Builder.Enumerator
+import Data.Monoid
+import qualified Data.Enumerator as E
+import Data.Enumerator (($$))
+import qualified Data.ByteString as S
+import qualified Data.ByteString.Lazy as L
+import Data.IORef
+import Control.Monad.IO.Class
+import Control.Monad (foldM)
+import Data.List (foldl')
+
+row = mconcat
+ [ fromByteString "<tr>"
+ , mconcat $ map go [1..100]
+ , fromByteString "</tr>"
+ ]
+ where
+ go i = mconcat
+ [ fromByteString "<td>"
+ , fromString $ show i
+ , fromByteString "</td>"
+ ]
+
+table = mconcat
+ [ fromByteString "<table>"
+ , mconcat $ replicate 1000 row
+ , fromByteString "</table>"
+ ]
+
+main = defaultMain
+ [ bgroup "ioref"
+ [ bench "pure" $ do
+ x <- newIORef (0 :: Int)
+ let go bs = do
+ x' <- readIORef x
+ writeIORef x $ x' + S.length bs
+ mapM_ go $ L.toChunks $ toLazyByteString table
+ readIORef x
+ , bench "enumeratee" $ do
+ x <- newIORef (0 :: Int)
+ let iter = do
+ mbs <- E.head
+ case mbs of
+ Nothing -> return ()
+ Just bs -> do
+ x' <- liftIO $ readIORef x
+ liftIO $ writeIORef x $ x' + S.length bs
+ iter
+ E.run_ $ E.enumList 1 [table] $$ E.joinI
+ $ builderToByteString $$ iter
+ readIORef x
+ ]
+ , bgroup "accum"
+ [ let go i bs = i + S.length bs
+ in bench "pure" $ flip nf table $ foldl' go 0 . L.toChunks . toLazyByteString
+ , bench "enumeratee" $ do
+ let go i bs = i + S.length bs
+ E.run_ $ E.enumList 1 [table] $$ E.joinI
+ $ builderToByteString $$ E.liftFoldL' go 0 :: IO Int
+ ]
+ ]
@@ -1,5 +1,5 @@
Name : blaze-builder-enumerator
-Version : 0.2.0.0
+Version : 0.2.0.1
Synopsis : Enumeratees for the incremental conversion of builders to
bytestrings.
Description :
@@ -11,7 +11,7 @@ Description :
Author : Simon Meier <iridcode@gmail.com>
Maintainer : Simon Meier <iridcode@gmail.com>
-Copyright : Copyright (c) 2010 Simon Meier
+Copyright : Copyright (c) 2010, 2011 Simon Meier
original package by Thomas Sutton <me@thomas-sutton.id.au>
@@ -29,12 +29,12 @@ Source-repository head
Location: https://github.com/meiersi/blaze-builder-enumerator.git
Library
- GHC-options: -Wall -fno-warn-unused-do-bind
+ GHC-options: -Wall
Build-depends:
- base >= 4 && < 5
- , blaze-builder >= 0.2.1 && < 0.3
- , bytestring >= 0.9 && < 0.10
- , enumerator >= 0.4.3.1 && < 0.5
- , transformers >= 0.2 && < 0.3
+ base >= 4 && < 5
+ , blaze-builder >= 0.2.1 && < 0.3
+ , bytestring >= 0.9 && < 0.10
+ , enumerator >= 0.4.3.1 && < 0.5
+ , transformers >= 0.2 && < 0.3
Exposed-modules:
Blaze.ByteString.Builder.Enumerator

0 comments on commit 86d219a

Please sign in to comment.