blaze-builder 0.4.3 → 0.4.4
raw patch · 13 files changed
+258/−326 lines, 13 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- Blaze/ByteString/Builder/Char/Utf8.hs +4/−2
- CHANGELOG.md +180/−0
- CHANGES +0/−173
- TODO +0/−73
- benchmarks/BenchmarkServer.hs +10/−10
- benchmarks/StrictIO.hs +0/−3
- benchmarks/Throughput/BinaryBuilder.hs +1/−1
- benchmarks/Throughput/BlazeBuilder.hs +2/−2
- benchmarks/Throughput/BlazeBuilderDeclarative.hs +1/−2
- benchmarks/Throughput/BlazePut.hs +51/−51
- benchmarks/Throughput/BlazePutMonad.hs +2/−2
- benchmarks/Throughput/Utils.hs +1/−2
- blaze-builder.cabal +6/−5
Blaze/ByteString/Builder/Char/Utf8.hs view
@@ -29,7 +29,9 @@ import qualified Data.ByteString.Builder as B import qualified Data.ByteString.Builder.Prim as P import qualified Data.Text as TS+import qualified Data.Text.Encoding as TE import qualified Data.Text.Lazy as TL+import qualified Data.Text.Lazy.Encoding as TLE -- | Write a UTF-8 encoded Unicode character to a buffer. --@@ -59,11 +61,11 @@ -- | /O(n)/. Serialize a strict Unicode 'TS.Text' value using the UTF-8 encoding. -- fromText :: TS.Text -> Builder-fromText = fromString . TS.unpack+fromText = TE.encodeUtf8Builder {-# INLINE fromText #-} -- | /O(n)/. Serialize a lazy Unicode 'TL.Text' value using the UTF-8 encoding. -- fromLazyText :: TL.Text -> Builder-fromLazyText = fromString . TL.unpack+fromLazyText = TLE.encodeUtf8Builder {-# INLINE fromLazyText #-}
+ CHANGELOG.md view
@@ -0,0 +1,180 @@+* 0.4.4 2025-07-31+ - Optimization:+ `Blaze.ByteString.Builder.Char.Utf8.fromText = Data.Text.Encoding.encodeUtf8Builder`+ rather than going through `String`.+ (Alex Biehl, PR #11 https://github.com/blaze-builder/blaze-builder/pull/11)+ - Tested with GHC 8.0 - 9.12.2++* 0.4.3 2025-05-15+ - Fix computation of max buffer overhead on 32 bit platforms+ (sternenseemann, PR #8 https://github.com/blaze-builder/blaze-builder/pull/8)+ - Drop support for GHC 7, bytestring < 0.10.4 and text < 1.1.2+ - Tested with GHC 8.0 - 9.12.2++* 0.4.2.3 2023-08-27+ - Fix compilation warnings concerning non-canonical mappend+ - Support bytestring-0.12+ - Support text-2.1+ - Tested with GHC 7.0.4 to 9.8.1 alpha3++* 0.4.2.2+ - Support GHC 9.2++* 0.4.2.1+ - Bump cabal file to Cabal >= 1.10++* 0.4.2.0+ - Make semigroup instances unconditional+ - Support bytestring-0.11+ - Support semigroups-0.19++* 0.4.1.0+ - Gain compatibility with the Semigroup/Monoid proposal+ - Add Word8 HTML escaping builders+ - Speed up `fromHtmlEscapedText` and `fromHtmlEscapedLazyText`++* 0.4.0.2+ - Fixed warnings on GHC 7.10, courtesy of Mikhail Glushenkov.++* 0.4.0.1+ - Tightened the version constraints on the bytestring package for GHC 7.8++* 0.4.0.0+ - This is now a compatibility shim for the new bytestring builder. Most+ of the old internal modules are gone. See this blog post for more+ information:++ <http://blog.melding-monads.com/2015/02/12/announcing-blaze-builder-0-4/>++ - The 'Blaze.ByteString.Builder.Html.Utf8.fromHtmlEscaped*' functions now+ strip out any ASCII control characters present in their inputs. See+ <https://github.com/lpsmith/blaze-builder/issues/1> for more+ information.++* 0.3.3.0+ - exposed the 'Buffer' constructor to enable keeping around a pool of+ buffers.++* 0.3.2.0+ - added 'writeToByteString' to construct a strict bytestring in a single+ step. We can actually view 'Write's as strict-bytestring builders.++* 0.3.1.1+ - Changed imports of Foreign.Unsafe to make it GHC 7.8 compatible+ - -Wall clean on GHC 7.0 - 7.6++* 0.3.1.0+ - Widened dependencies on text and bytestring++* 0.3.0.1++ - Fix build warning in Blaze.ByteString.Builder.Word+ (contributed by Greg Weber)++* 0.3.0.1++ - Remove comparison to the 'text' library encoding functions of+ 'Blaze.Builder.Char.Utf8.fromText' and+ 'Blaze.Builder.Char.Utf8.fromLazyText'. Bryan O'Sullivan reported that on+ his 64-bit system with GHC 7.0.3 the 'text' library is 5x faster than the+ 'blaze-builder' library.++* 0.3.0.0++ - Renamings in internal modules: WriteIO -> Poke and associated functions.++* 0.2.1.4++ - Fixed bug: appending to 'chunkedTransferEncoding somebuilder' also encoded+ the appended builder, which is obviously wrong.++* 0.2.1.3++ - Fixed bug: 'chunkedTransferTerminator' is now correctly set to "0\r\n\r\n".++* 0.2.1.2++ - Add 'MonoPatBinds' language extension to all relevant files to solve the+ issues caused by GHC bug http://hackage.haskell.org/trac/ghc/ticket/4498++* 0.2.1.1++ - Reexport 'Write' datatype and 'fromWriteList', 'fromWriteSingleton',+ 'fromWrite' functions together with writes and builders for storables.+ - Add 'MonoPatBinds' language extension to (hopefully) solve the issues+ caused by GHC bug http://hackage.haskell.org/trac/ghc/ticket/4498++* 0.2.1.0++ Incorporated several design changes:+ - Writable buffer range is now represented in a packed form. This improves+ speed slightly, as less currying is used.+ - Writes are abstracted such that their internal representation can be+ exchanged without breaking other library code.+ - Writes are represented in a form that allows for efficient monoid+ instances for branching code like UTF-8 encoding. For single character+ encoding this results currently in a slight slowdown due to GHC not+ recognizing the strictness of the returned value. This will be fixed in+ the future.+ - BuildSteps support returning a result in `Done`, which enables to+ implement a `Put` monad using CPS.+ - chunked list writes were removed, as they result in worse performance+ when writing non-trivial lists. (cf. benchmarks)+ - An internal buffering abstraction is introduced, which is used both+ by the adaption of the `binary` package, as well as by the+ `blaze-builder-enumeratee` package, to execute puts and builders.+ It will be used later also by the execution functions of the+ `blaze-builder` package.++ Implemented new functionality+ - `Blaze.ByteString.Builder.HTTP` provides a builder transformer for+ doing in-buffer chunked HTTP encoding of an arbitary other builder.+ - `Blaze.ByteString.Builder.Char8` provides functions to serialize the+ lower 8-bits of characters similiar to what `Data.ByteString.Char8`+ provides for bytestrings.++* 0.2.0.3++ Loosen 'text' dependency to '>= 0.10 && < 0.12'++* 0.2.0.2++ Fixed bug: use ' instead of ' for HTML escaping '++* 0.2.0.1++ Added a missing benchmark file.++* blaze-builder-0.2.0.0++ Heavily restructured 'blaze-builder' such that 'Blaze.ByteString.Builder' serves as+ a drop-in replacement of 'binary:Data.Binary.Builder' which it improves upon+ with respect to both speed as well as expressivity. See the documentation and+ the benchmarks for details on improvements and new functionality.++ Changed module structure:+ Blaze.ByteString.Builder.Core -> Blaze.ByteString.Builder+ Blaze.ByteString.Builder.Utf8 -> Blaze.ByteString.Builder.Char.Utf8+ Blaze.ByteString.Builder.Html -> Blaze.ByteString.Builder.Html.Utf8++ Changed function names:+ writeByte -> writeWord8+ fromByte -> fromWord8+ fromWriteList -> fromWrite1List++ Possibly performance sensitive implementation changes:+ - 'fromByteString' and 'fromLazyByteString' check now if a direct insertion+ of the bytestring(s) would be cheaper than copying it. See their+ documentation on how to recover the old behaviour.++ Deprecated functions:+ 'empty' : use 'mempty' instead+ 'singleton': use 'fromWord8' instead+ 'append' : use 'mappend' instead+++* blaze-builder-0.1++ This is the first version of 'blaze-builder'. It is explicitely targeted at+ fast generation of UTF-8 encoded HTML documents in the 'blaze-html' and the+ 'hamlet' HTML templating libraries.
− CHANGES
@@ -1,173 +0,0 @@-* 0.4.3 2025-05-15- - Fix computation of max buffer overhead on 32 bit platforms- (sternenseemann, PR #8 https://github.com/blaze-builder/blaze-builder/pull/8)- - Drop support for GHC 7, bytestring < 0.10.4 and text < 1.1.2- - Tested with GHC 8.0 - 9.12.2--* 0.4.2.3 2023-08-27- - Fix compilation warnings concerning non-canonical mappend- - Support bytestring-0.12- - Support text-2.1- - Tested with GHC 7.0.4 to 9.8.1 alpha3--* 0.4.2.2- - Support GHC 9.2--* 0.4.2.1- - Bump cabal file to Cabal >= 1.10--* 0.4.2.0- - Make semigroup instances unconditional- - Support bytestring-0.11- - Support semigroups-0.19--* 0.4.1.0- - Gain compatibility with the Semigroup/Monoid proposal- - Add Word8 HTML escaping builders- - Speed up `fromHtmlEscapedText` and `fromHtmlEscapedLazyText`--* 0.4.0.2- - Fixed warnings on GHC 7.10, courtesy of Mikhail Glushenkov.--* 0.4.0.1- - Tightened the version constraints on the bytestring package for GHC 7.8--* 0.4.0.0- - This is now a compatibility shim for the new bytestring builder. Most- of the old internal modules are gone. See this blog post for more- information:-- <http://blog.melding-monads.com/2015/02/12/announcing-blaze-builder-0-4/>-- - The 'Blaze.ByteString.Builder.Html.Utf8.fromHtmlEscaped*' functions now- strip out any ASCII control characters present in their inputs. See- <https://github.com/lpsmith/blaze-builder/issues/1> for more- information.--* 0.3.3.0- - exposed the 'Buffer' constructor to enable keeping around a pool of- buffers.--* 0.3.2.0- - added 'writeToByteString' to construct a strict bytestring in a single- step. We can actually view 'Write's as strict-bytestring builders.--* 0.3.1.1- - Changed imports of Foreign.Unsafe to make it GHC 7.8 compatible- - -Wall clean on GHC 7.0 - 7.6--* 0.3.1.0- - Widened dependencies on text and bytestring--* 0.3.0.1-- - Fix build warning in Blaze.ByteString.Builder.Word- (contributed by Greg Weber)--* 0.3.0.1-- - Remove comparison to the 'text' library encoding functions of- 'Blaze.Builder.Char.Utf8.fromText' and- 'Blaze.Builder.Char.Utf8.fromLazyText'. Bryan O'Sullivan reported that on- his 64-bit system with GHC 7.0.3 the 'text' library is 5x faster than the- 'blaze-builder' library.--* 0.3.0.0-- - Renamings in internal modules: WriteIO -> Poke and associated functions.--* 0.2.1.4-- - Fixed bug: appending to 'chunkedTransferEncoding somebuilder' also encoded- the appended builder, which is obviously wrong.--* 0.2.1.3-- - Fixed bug: 'chunkedTransferTerminator' is now correctly set to "0\r\n\r\n".--* 0.2.1.2-- - Add 'MonoPatBinds' language extension to all relevant files to solve the- issues caused by GHC bug http://hackage.haskell.org/trac/ghc/ticket/4498--* 0.2.1.1-- - Reexport 'Write' datatype and 'fromWriteList', 'fromWriteSingleton',- 'fromWrite' functions together with writes and builders for storables.- - Add 'MonoPatBinds' language extension to (hopefully) solve the issues- caused by GHC bug http://hackage.haskell.org/trac/ghc/ticket/4498--* 0.2.1.0-- Incorporated several design changes:- - Writable buffer range is now represented in a packed form. This improves- speed slightly, as less currying is used.- - Writes are abstracted such that their internal representation can be- exchanged without breaking other library code.- - Writes are represented in a form that allows for efficient monoid- instances for branching code like UTF-8 encoding. For single character- encoding this results currently in a slight slowdown due to GHC not- recognizing the strictness of the returned value. This will be fixed in- the future.- - BuildSteps support returning a result in `Done`, which enables to- implement a `Put` monad using CPS.- - chunked list writes were removed, as they result in worse performance- when writing non-trivial lists. (cf. benchmarks)- - An internal buffering abstraction is introduced, which is used both- by the adaption of the `binary` package, as well as by the- `blaze-builder-enumeratee` package, to execute puts and builders.- It will be used later also by the execution functions of the- `blaze-builder` package.-- Implemented new functionality- - `Blaze.ByteString.Builder.HTTP` provides a builder transformer for- doing in-buffer chunked HTTP encoding of an arbitary other builder.- - `Blaze.ByteString.Builder.Char8` provides functions to serialize the- lower 8-bits of characters similiar to what `Data.ByteString.Char8`- provides for bytestrings.--* 0.2.0.3-- Loosen 'text' dependency to '>= 0.10 && < 0.12'--* 0.2.0.2-- Fixed bug: use ' instead of ' for HTML escaping '--* 0.2.0.1-- Added a missing benchmark file.--* blaze-builder-0.2.0.0-- Heavily restructured 'blaze-builder' such that 'Blaze.ByteString.Builder' serves as- a drop-in replacement of 'binary:Data.Binary.Builder' which it improves upon- with respect to both speed as well as expressivity. See the documentation and- the benchmarks for details on improvements and new functionality.-- Changed module structure:- Blaze.ByteString.Builder.Core -> Blaze.ByteString.Builder- Blaze.ByteString.Builder.Utf8 -> Blaze.ByteString.Builder.Char.Utf8- Blaze.ByteString.Builder.Html -> Blaze.ByteString.Builder.Html.Utf8-- Changed function names:- writeByte -> writeWord8- fromByte -> fromWord8- fromWriteList -> fromWrite1List-- Possibly performance sensitive implementation changes:- - 'fromByteString' and 'fromLazyByteString' check now if a direct insertion- of the bytestring(s) would be cheaper than copying it. See their- documentation on how to recover the old behaviour.-- Deprecated functions:- 'empty' : use 'mempty' instead- 'singleton': use 'fromWord8' instead- 'append' : use 'mappend' instead---* blaze-builder-0.1-- This is the first version of 'blaze-builder'. It is explicitely targeted at- fast generation of UTF-8 encoded HTML documents in the 'blaze-html' and the- 'hamlet' HTML templating libraries.
− TODO
@@ -1,73 +0,0 @@--!! UPDATE TODO !!--!! UPDATE BENCHMARKS !!- - * custom serialization functions for lists of 'WordX's- - benchmark chunk size speedup for more complicated computations of list- elements => to be expected that we get no speedup anymore or even a- slowdown => adapt Blaze.ByteString.Builder.Word accordingly.-- * fast serialization for 'Text' values (currently unpacking to 'String' is- the fastest :-/)-- * implementation- - further encodings for 'Char'- - think about end-of-buffer wrapping when copying bytestrings- - toByteStringIO with accumulator capability => provide 'toByteStringIO_'- - allow buildr/foldr deforestation to happen for input to 'fromWrite<n>List'- (or whatever stream fusion framework is in place for lists)- - implement 'toByteString' with an amortized O(n) runtime using the- exponentional scaling trick. If the start size is chosen wisely this- may even be faster than 'S.pack', as the one copy per element is- cheaper than one list thunk per element. It is even likely that we can- amortize three copies per element, which allows to avoid spilling any- buffer space by doing a last compaction copy.- - we could provide builders that honor alignment restrictions, either as- builder transformers or as specialized write to builder converters. The- trick is for the driver to ensure that the buffer beginning is aligned- to the largest aligning (8 or 16 bytes?) required. This is probably the- case by default. Then we can always align a pointer in the buffer by - appropriately aligning the write pointer.-- * extend tests to new functions-- * benchmarks- - understand why the declarative blaze-builder version is the fastest- serializer for Word64 little-endian and big-endian - - check the cost of using `mappend` on builders instead of writes.- - show that using toByteStringIO has an advantage over toLazyByteString- - check performance of toByteStringIO- - compare speed of 'L.pack' to speed of 'toLazyByteString . fromWord8s'-- * documentation- - sort out formultion: "serialization" vs. "encoding"-- * check portability to Hugs-- * performance:- - check if reordering 'pe' and 'pf' change performance; it seems that 'pe'- is only a reader argument while 'pf' is a state argument.- - perhaps we could improve performance by taking page size, page- alignment, and memory access alignment into account.- - detect machine endianness and use host order writes for the supported- endianness.- - introduce a type 'BoundedWrite' that encapsulates a 'Write' generator- with a bound on the number of bytes maximally written by the write.- This way we can achieve data independence for the size check by- sacrificing just a little bit of buffer space at buffer ends.- - investigate where we would profit from static bounds on number of bytes- written (e.g. to make the control flow more linear)-- * testing- - port tests from 'Data.Binary.Builder' to ensure that the word writes- and builders are working correctly. I may have missed some pitfalls- about word types in Haskell during porting the functions from- 'Data.Binary.Builder'.-- * portability- - port to Hugs- - test lower versions of GHC-- * deployment- - add source repository to 'blaze-html' and 'blaze-builder' cabal files
benchmarks/BenchmarkServer.hs view
@@ -8,7 +8,7 @@ import Prelude hiding (putStrLn) import Data.Char (ord)-import Data.Monoid +import Data.Monoid import Data.ByteString.Char8 () -- IsString instance only import qualified Data.ByteString as S import qualified Data.ByteString.Lazy as L@@ -16,7 +16,7 @@ import Control.Concurrent (forkIO, putMVar, takeMVar, newEmptyMVar) import Control.Exception (bracket)-import Control.Monad +import Control.Monad import Network.Socket (Socket, accept, sClose) import Network (listenOn, PortID (PortNumber))@@ -31,15 +31,15 @@ import Criterion.Main -httpOkHeader :: S.ByteString -httpOkHeader = S.concat +httpOkHeader :: S.ByteString+httpOkHeader = S.concat [ "HTTP/1.1 200 OK\r\n" , "Content-Type: text/html; charset=UTF-8\r\n" , "\r\n" ] response :: Int -> Builder-response n = - fromByteString httpOkHeader `mappend` +response n =+ fromByteString httpOkHeader `mappend` fromString (take n $ cycle "hello λ-world! ") sendVectoredBuilderLBS :: Socket -> Builder -> IO ()@@ -47,7 +47,7 @@ {-# NOINLINE sendVectoredBuilderLBS #-} sendBuilderLBS :: Socket -> Builder -> IO ()-sendBuilderLBS s = +sendBuilderLBS s = -- mapM_ (S.sendAll s) . L.toChunks . toLazyByteString L.foldrChunks (\c -> (S.sendAll s c >>)) (return ()). toLazyByteString {-# NOINLINE sendBuilderLBS #-}@@ -58,7 +58,7 @@ -- criterion benchmark determining the speed of response main2 = defaultMain- [ bench ("response " ++ show n) $ whnf + [ bench ("response " ++ show n) $ whnf (L.length . toLazyByteString . response) n ] where@@ -69,12 +69,12 @@ main = do [port, nChars] <- map read `liftM` getArgs killSignal <- newEmptyMVar- bracket (listenOn . PortNumber . fromIntegral $ port) sClose + bracket (listenOn . PortNumber . fromIntegral $ port) sClose (\socket -> do _ <- forkIO $ loop (putMVar killSignal ()) nChars socket takeMVar killSignal) where- loop killServer nChars socket = forever $ do + loop killServer nChars socket = forever $ do (s, _) <- accept socket forkIO (respond s nChars) where
benchmarks/StrictIO.hs view
@@ -23,6 +23,3 @@ return $ i + 1 {-# INLINE subcases #-} -- -
benchmarks/Throughput/BinaryBuilder.hs view
@@ -195,7 +195,7 @@ writeWord16N1Little = loop 0 where loop s n | s `seq` n `seq` False = undefined loop _ 0 = mempty- loop s n = + loop s n = (putWord16le (s+0)) `mappend` loop (s+1) (n-1)
benchmarks/Throughput/BlazeBuilder.hs view
@@ -11,7 +11,7 @@ import Throughput.Utils serialize :: Int -> Int -> Endian -> Int -> L.ByteString-serialize wordSize chunkSize end = toLazyByteString . +serialize wordSize chunkSize end = toLazyByteString . case (wordSize, chunkSize, end) of (1, 1,_) -> writeByteN1 (1, 2,_) -> writeByteN2@@ -201,7 +201,7 @@ writeWord16N1Little = loop 0 where loop s n | s `seq` n `seq` False = undefined loop _ 0 = mempty- loop s n = + loop s n = fromWrite (writeWord16le (s+0)) `mappend` loop (s+1) (n-1)
benchmarks/Throughput/BlazeBuilderDeclarative.hs view
@@ -12,7 +12,7 @@ import Throughput.Utils serialize :: Int -> Int -> Endian -> Int -> L.ByteString-serialize wordSize chunkSize end = toLazyByteString . +serialize wordSize chunkSize end = toLazyByteString . case (wordSize, chunkSize, end) of (1, 1,_) -> writeByteN1 (1, 2,_) -> writeByteN2@@ -193,5 +193,4 @@ writeWord64N4Host = fromWrite4List writeWord64host . word64List writeWord64N8Host = fromWrite8List writeWord64host . word64List writeWord64N16Host = fromWrite16List writeWord64host . word64List-
benchmarks/Throughput/BlazePut.hs view
@@ -2,7 +2,7 @@ module Throughput.BlazePut (serialize) where import qualified Data.ByteString.Lazy as L-import Blaze.ByteString.Builder +import Blaze.ByteString.Builder import Throughput.BlazePutMonad as Put import Data.Monoid @@ -12,7 +12,7 @@ ------------------------------------------------------------------------ serialize :: Int -> Int -> Endian -> Int -> L.ByteString-serialize wordSize chunkSize end = runPut . +serialize wordSize chunkSize end = runPut . case (wordSize, chunkSize, end) of (1, 1,_) -> writeByteN1 (1, 2,_) -> writeByteN2@@ -72,7 +72,7 @@ writeByteN1 bytes = loop 0 0 where loop !s !n | n == bytes = return ()- | otherwise = do + | otherwise = do Put.putWrite ( writeWord8 s) loop (s+1) (n+1) @@ -88,7 +88,7 @@ writeByteN4 = loop 0 where loop s n | s `seq` n `seq` False = undefined loop _ 0 = return ()- loop s n = do + loop s n = do Put.putWrite ( writeWord8 (s+0) `mappend` writeWord8 (s+1) `mappend`@@ -99,7 +99,7 @@ writeByteN8 = loop 0 where loop s n | s `seq` n `seq` False = undefined loop _ 0 = return ()- loop s n = do + loop s n = do Put.putWrite ( writeWord8 (s+0) `mappend` writeWord8 (s+1) `mappend`@@ -114,7 +114,7 @@ writeByteN16 = loop 0 where loop s n | s `seq` n `seq` False = undefined loop _ 0 = return ()- loop s n = do + loop s n = do Put.putWrite ( writeWord8 (s+0) `mappend` writeWord8 (s+1) `mappend`@@ -140,14 +140,14 @@ writeWord16N1Big = loop 0 where loop s n | s `seq` n `seq` False = undefined loop _ 0 = return ()- loop s n = do + loop s n = do Put.putWord16be (s+0) loop (s+1) (n-1) writeWord16N2Big = loop 0 where loop s n | s `seq` n `seq` False = undefined loop _ 0 = return ()- loop s n = do + loop s n = do Put.putWrite ( writeWord16be (s+0) `mappend` writeWord16be (s+1))@@ -156,7 +156,7 @@ writeWord16N4Big = loop 0 where loop s n | s `seq` n `seq` False = undefined loop _ 0 = return ()- loop s n = do + loop s n = do Put.putWrite ( writeWord16be (s+0) `mappend` writeWord16be (s+1) `mappend`@@ -167,7 +167,7 @@ writeWord16N8Big = loop 0 where loop s n | s `seq` n `seq` False = undefined loop _ 0 = return ()- loop s n = do + loop s n = do Put.putWrite ( writeWord16be (s+0) `mappend` writeWord16be (s+1) `mappend`@@ -182,7 +182,7 @@ writeWord16N16Big = loop 0 where loop s n | s `seq` n `seq` False = undefined loop _ 0 = return ()- loop s n = do + loop s n = do Put.putWrite ( writeWord16be (s+0) `mappend` writeWord16be (s+1) `mappend`@@ -208,14 +208,14 @@ writeWord16N1Little = loop 0 where loop s n | s `seq` n `seq` False = undefined loop _ 0 = return ()- loop s n = + loop s n = do Put.putWord16le (s+0) loop (s+1) (n-1) writeWord16N2Little = loop 0 where loop s n | s `seq` n `seq` False = undefined loop _ 0 = return ()- loop s n = do + loop s n = do Put.putWrite ( writeWord16le (s+0) `mappend` writeWord16le (s+1))@@ -224,7 +224,7 @@ writeWord16N4Little = loop 0 where loop s n | s `seq` n `seq` False = undefined loop _ 0 = return ()- loop s n = do + loop s n = do Put.putWrite ( writeWord16le (s+0) `mappend` writeWord16le (s+1) `mappend`@@ -235,7 +235,7 @@ writeWord16N8Little = loop 0 where loop s n | s `seq` n `seq` False = undefined loop _ 0 = return ()- loop s n = do + loop s n = do Put.putWrite ( writeWord16le (s+0) `mappend` writeWord16le (s+1) `mappend`@@ -250,7 +250,7 @@ writeWord16N16Little = loop 0 where loop s n | s `seq` n `seq` False = undefined loop _ 0 = return ()- loop s n = do + loop s n = do Put.putWrite ( writeWord16le (s+0) `mappend` writeWord16le (s+1) `mappend`@@ -276,14 +276,14 @@ writeWord16N1Host = loop 0 where loop s n | s `seq` n `seq` False = undefined loop _ 0 = return ()- loop s n = do + loop s n = do Put.putWord16host (s+0) loop (s+1) (n-1) writeWord16N2Host = loop 0 where loop s n | s `seq` n `seq` False = undefined loop _ 0 = return ()- loop s n = do + loop s n = do Put.putWrite ( writeWord16host (s+0) `mappend` writeWord16host (s+1))@@ -292,7 +292,7 @@ writeWord16N4Host = loop 0 where loop s n | s `seq` n `seq` False = undefined loop _ 0 = return ()- loop s n = do + loop s n = do Put.putWrite ( writeWord16host (s+0) `mappend` writeWord16host (s+1) `mappend`@@ -303,7 +303,7 @@ writeWord16N8Host = loop 0 where loop s n | s `seq` n `seq` False = undefined loop _ 0 = return ()- loop s n = do + loop s n = do Put.putWrite ( writeWord16host (s+0) `mappend` writeWord16host (s+1) `mappend`@@ -318,7 +318,7 @@ writeWord16N16Host = loop 0 where loop s n | s `seq` n `seq` False = undefined loop _ 0 = return ()- loop s n = do + loop s n = do Put.putWrite ( writeWord16host (s+0) `mappend` writeWord16host (s+1) `mappend`@@ -343,14 +343,14 @@ writeWord32N1Big = loop 0 where loop s n | s `seq` n `seq` False = undefined loop _ 0 = return ()- loop s n = do + loop s n = do Put.putWord32be (s+0) loop (s+1) (n-1) writeWord32N2Big = loop 0 where loop s n | s `seq` n `seq` False = undefined loop _ 0 = return ()- loop s n = do + loop s n = do Put.putWrite ( writeWord32be (s+0) `mappend` writeWord32be (s+1))@@ -359,7 +359,7 @@ writeWord32N4Big = loop 0 where loop s n | s `seq` n `seq` False = undefined loop _ 0 = return ()- loop s n = do + loop s n = do Put.putWrite ( writeWord32be (s+0) `mappend` writeWord32be (s+1) `mappend`@@ -370,7 +370,7 @@ writeWord32N8Big = loop 0 where loop s n | s `seq` n `seq` False = undefined loop _ 0 = return ()- loop s n = do + loop s n = do Put.putWrite ( writeWord32be (s+0) `mappend` writeWord32be (s+1) `mappend`@@ -385,7 +385,7 @@ writeWord32N16Big = loop 0 where loop s n | s `seq` n `seq` False = undefined loop _ 0 = return ()- loop s n = do + loop s n = do Put.putWrite ( writeWord32be (s+0) `mappend` writeWord32be (s+1) `mappend`@@ -410,14 +410,14 @@ writeWord32N1Little = loop 0 where loop s n | s `seq` n `seq` False = undefined loop _ 0 = return ()- loop s n = do + loop s n = do Put.putWord32le (s+0) loop (s+1) (n-1) writeWord32N2Little = loop 0 where loop s n | s `seq` n `seq` False = undefined loop _ 0 = return ()- loop s n = do + loop s n = do Put.putWrite ( writeWord32le (s+0) `mappend` writeWord32le (s+1))@@ -426,7 +426,7 @@ writeWord32N4Little = loop 0 where loop s n | s `seq` n `seq` False = undefined loop _ 0 = return ()- loop s n = do + loop s n = do Put.putWrite ( writeWord32le (s+0) `mappend` writeWord32le (s+1) `mappend`@@ -437,7 +437,7 @@ writeWord32N8Little = loop 0 where loop s n | s `seq` n `seq` False = undefined loop _ 0 = return ()- loop s n = do + loop s n = do Put.putWrite ( writeWord32le (s+0) `mappend` writeWord32le (s+1) `mappend`@@ -452,7 +452,7 @@ writeWord32N16Little = loop 0 where loop s n | s `seq` n `seq` False = undefined loop _ 0 = return ()- loop s n = do + loop s n = do Put.putWrite ( writeWord32le (s+0) `mappend` writeWord32le (s+1) `mappend`@@ -477,14 +477,14 @@ writeWord32N1Host = loop 0 where loop s n | s `seq` n `seq` False = undefined loop _ 0 = return ()- loop s n = do + loop s n = do Put.putWord32host (s+0) loop (s+1) (n-1) writeWord32N2Host = loop 0 where loop s n | s `seq` n `seq` False = undefined loop _ 0 = return ()- loop s n = do + loop s n = do Put.putWrite ( writeWord32host (s+0) `mappend` writeWord32host (s+1))@@ -493,7 +493,7 @@ writeWord32N4Host = loop 0 where loop s n | s `seq` n `seq` False = undefined loop _ 0 = return ()- loop s n = do + loop s n = do Put.putWrite ( writeWord32host (s+0) `mappend` writeWord32host (s+1) `mappend`@@ -504,7 +504,7 @@ writeWord32N8Host = loop 0 where loop s n | s `seq` n `seq` False = undefined loop _ 0 = return ()- loop s n = do + loop s n = do Put.putWrite ( writeWord32host (s+0) `mappend` writeWord32host (s+1) `mappend`@@ -519,7 +519,7 @@ writeWord32N16Host = loop 0 where loop s n | s `seq` n `seq` False = undefined loop _ 0 = return ()- loop s n = do + loop s n = do Put.putWrite ( writeWord32host (s+0) `mappend` writeWord32host (s+1) `mappend`@@ -544,14 +544,14 @@ writeWord64N1Big = loop 0 where loop s n | s `seq` n `seq` False = undefined loop _ 0 = return ()- loop s n = do + loop s n = do Put.putWord64be (s+0) loop (s+1) (n-1) writeWord64N2Big = loop 0 where loop s n | s `seq` n `seq` False = undefined loop _ 0 = return ()- loop s n = do + loop s n = do Put.putWrite ( writeWord64be (s+0) `mappend` writeWord64be (s+1))@@ -560,7 +560,7 @@ writeWord64N4Big = loop 0 where loop s n | s `seq` n `seq` False = undefined loop _ 0 = return ()- loop s n = do + loop s n = do Put.putWrite ( writeWord64be (s+0) `mappend` writeWord64be (s+1) `mappend`@@ -571,7 +571,7 @@ writeWord64N8Big = loop 0 where loop s n | s `seq` n `seq` False = undefined loop _ 0 = return ()- loop s n = do + loop s n = do Put.putWrite ( writeWord64be (s+0) `mappend` writeWord64be (s+1) `mappend`@@ -586,7 +586,7 @@ writeWord64N16Big = loop 0 where loop s n | s `seq` n `seq` False = undefined loop _ 0 = return ()- loop s n = do + loop s n = do Put.putWrite ( writeWord64be (s+0) `mappend` writeWord64be (s+1) `mappend`@@ -611,14 +611,14 @@ writeWord64N1Little = loop 0 where loop s n | s `seq` n `seq` False = undefined loop _ 0 = return ()- loop s n = do + loop s n = do Put.putWord64le (s+0) loop (s+1) (n-1) writeWord64N2Little = loop 0 where loop s n | s `seq` n `seq` False = undefined loop _ 0 = return ()- loop s n = do + loop s n = do Put.putWrite ( writeWord64le (s+0) `mappend` writeWord64le (s+1))@@ -627,7 +627,7 @@ writeWord64N4Little = loop 0 where loop s n | s `seq` n `seq` False = undefined loop _ 0 = return ()- loop s n = do + loop s n = do Put.putWrite ( writeWord64le (s+0) `mappend` writeWord64le (s+1) `mappend`@@ -638,7 +638,7 @@ writeWord64N8Little = loop 0 where loop s n | s `seq` n `seq` False = undefined loop _ 0 = return ()- loop s n = do + loop s n = do Put.putWrite ( writeWord64le (s+0) `mappend` writeWord64le (s+1) `mappend`@@ -653,7 +653,7 @@ writeWord64N16Little = loop 0 where loop s n | s `seq` n `seq` False = undefined loop _ 0 = return ()- loop s n = do + loop s n = do Put.putWrite ( writeWord64le (s+0) `mappend` writeWord64le (s+1) `mappend`@@ -678,14 +678,14 @@ writeWord64N1Host = loop 0 where loop s n | s `seq` n `seq` False = undefined loop _ 0 = return ()- loop s n = do + loop s n = do Put.putWord64host (s+0) loop (s+1) (n-1) writeWord64N2Host = loop 0 where loop s n | s `seq` n `seq` False = undefined loop _ 0 = return ()- loop s n = do + loop s n = do Put.putWrite ( writeWord64host (s+0) `mappend` writeWord64host (s+1))@@ -694,7 +694,7 @@ writeWord64N4Host = loop 0 where loop s n | s `seq` n `seq` False = undefined loop _ 0 = return ()- loop s n = do + loop s n = do Put.putWrite ( writeWord64host (s+0) `mappend` writeWord64host (s+1) `mappend`@@ -705,7 +705,7 @@ writeWord64N8Host = loop 0 where loop s n | s `seq` n `seq` False = undefined loop _ 0 = return ()- loop s n = do + loop s n = do Put.putWrite ( writeWord64host (s+0) `mappend` writeWord64host (s+1) `mappend`@@ -720,7 +720,7 @@ writeWord64N16Host = loop 0 where loop s n | s `seq` n `seq` False = undefined loop _ 0 = return ()- loop s n = do + loop s n = do Put.putWrite ( writeWord64host (s+0) `mappend` writeWord64host (s+1) `mappend`
benchmarks/Throughput/BlazePutMonad.hs view
@@ -4,7 +4,7 @@ -- Module : Data.Binary.Put -- Copyright : Lennart Kolmodin -- License : BSD3-style (see LICENSE)--- +-- -- Maintainer : Lennart Kolmodin <kolmodin@dtek.chalmers.se> -- Stability : stable -- Portability : Portable to Hugs and GHC. Requires MPTCs@@ -64,7 +64,7 @@ ------------------------------------------------------------------------ --- XXX Strict in buffer only. +-- XXX Strict in buffer only. data PairS a = PairS a {-# UNPACK #-}!Builder sndS :: PairS a -> Builder
benchmarks/Throughput/Utils.hs view
@@ -1,5 +1,5 @@ module Throughput.Utils (- Endian(..) + Endian(..) ) where @@ -8,5 +8,4 @@ | Little | Host deriving (Eq,Ord,Show)-
blaze-builder.cabal view
@@ -1,5 +1,6 @@+Cabal-version: 1.18 Name: blaze-builder-Version: 0.4.3+Version: 0.4.4 Synopsis: Efficient buffered output. Description:@@ -30,7 +31,6 @@ Category: Data Build-type: Simple-Cabal-version: >= 1.10 Tested-with: GHC == 9.12.2@@ -47,11 +47,12 @@ GHC == 8.2.2 GHC == 8.0.2 +Extra-doc-files:+ README.markdown+ CHANGELOG.md+ Extra-source-files: Makefile- README.markdown- TODO- CHANGES benchmarks/*.hs benchmarks/Throughput/*.hs