Repository : ssh://darcs.haskell.org//srv/darcs/packages/bytestring On branch : master
http://hackage.haskell.org/trac/ghc/changeset/79c0e4bd83266de99a8e3e453c7a3b22d1a1599d >--------------------------------------------------------------- commit 79c0e4bd83266de99a8e3e453c7a3b22d1a1599d Author: Duncan Coutts <[email protected]> Date: Sun Nov 13 16:25:09 2011 +0000 Add new Builder monoid by Simon Meier The design of strict and lazy ByteStrings makes concatenation expensive. A builder monoid lets us efficiently build bytestrings by sticking bits together in an ad-hoc way. For example by pretty-printing or serialising. This is as opposed to a uniform approach using unfoldr. This is the result of a lot of work over several years by several people. This new version is by Simon Meier. It was based on the version by Jasper Van der Jeugt for the blaze-html library. The idea goes back further to the builder monoid in the binary library by Lennart Kolmodin and Ross Patterson. That was based on a builder monad by myself. The trick in all these designs is a continuation style monad/monoid for combining builders, and writing directly into buffers. The continuation trick allows it to be done in a non-persistent way, which in turn makes possible to just write directly into buffers. Simon and Jasper's implementation follows the same general approach at the previous designs but achieves better performance by paying careful attention to low level details like buffer filling strategies and minimising the number of buffer bounds checks. Data/ByteString/Lazy.hs | 3 + Data/ByteString/Lazy/Builder.hs | 437 ++++++++ Data/ByteString/Lazy/Builder/ASCII.hs | 265 +++++ Data/ByteString/Lazy/Builder/BasicEncoding.hs | 1111 ++++++++++++++++++++ .../ByteString/Lazy/Builder/BasicEncoding/ASCII.hs | 288 +++++ .../Lazy/Builder/BasicEncoding/Binary.hs | 521 +++++++++ .../Lazy/Builder/BasicEncoding/Internal.hs | 348 ++++++ .../Lazy/Builder/BasicEncoding/Internal/Base16.hs | 110 ++ .../Builder/BasicEncoding/Internal/Floating.hs | 69 ++ .../BasicEncoding/Internal/UncheckedShifts.hs | 105 ++ Data/ByteString/Lazy/Builder/Extras.hs | 126 +++ Data/ByteString/Lazy/Builder/Internal.hs | 835 +++++++++++++++ LICENSE | 5 +- bytestring.cabal | 28 +- cbits/itoa.c | 171 +++ 15 files changed, 4417 insertions(+), 5 deletions(-) Diff suppressed because of size. To see it, use: git show 79c0e4bd83266de99a8e3e453c7a3b22d1a1599d _______________________________________________ Cvs-libraries mailing list [email protected] http://www.haskell.org/mailman/listinfo/cvs-libraries
