bytestring-strict-builder 0.4.2 → 0.4.3
raw patch · 3 files changed
+21/−6 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- benchmarks/Main.hs +9/−2
- bytestring-strict-builder.cabal +4/−4
- library/ByteString/StrictBuilder.hs +8/−0
benchmarks/Main.hs view
@@ -1,12 +1,12 @@ module Main where -import Prelude+import Prelude hiding (concat) import Criterion.Main import ByteString.StrictBuilder main =- defaultMain [leftAppends, rightAppends]+ defaultMain [leftAppends, rightAppends, concat] leftAppends :: Benchmark leftAppends =@@ -27,3 +27,10 @@ where builder = foldr (<>) mempty bytesList++concat :: Benchmark+concat =+ bench "concat" $ whnf action $! replicate 10000 $ bytes "abc"+ where+ action bytesList =+ builderBytes (mconcat bytesList)
bytestring-strict-builder.cabal view
@@ -1,7 +1,7 @@ name: bytestring-strict-builder version:- 0.4.2+ 0.4.3 category: Text, ByteString, Builders, Serialization synopsis:@@ -9,9 +9,9 @@ description: According to <https://github.com/nikita-volkov/bytestring-builders-benchmark the competition benchmarks>, - this library provides the fastest builder of strict bytestrings. + this library provides on average the fastest builder of strict bytestrings. .- Practical benchmarks have proven it to be highly performant aswell.+ Practical benchmarks have proven it to be highly performant as well. The encoders from the \"postgresql-binary\" library have shown a stable performance improvement by factors of up to 10 after the migration from the standard builder to \"bytestring-strict-builder\".@@ -56,7 +56,7 @@ ByteString.StrictBuilder.UTF8 build-depends: semigroups >= 0.18 && < 0.19,- bytestring >= 0.10 && < 0.11,+ bytestring >= 0.10.2 && < 0.11, base-prelude >= 1.2 && < 2, base >= 4.6 && < 5
library/ByteString/StrictBuilder.hs view
@@ -40,6 +40,14 @@ {-# INLINE mappend #-} mappend (Builder leftSize leftPopulation) (Builder rightSize rightPopulation) = Builder (leftSize + rightSize) (leftPopulation <> rightPopulation)+ {-# INLINE mconcat #-}+ mconcat builders =+ Builder size population+ where+ size =+ getSum (foldMap (\(Builder x _) -> Sum x) builders)+ population =+ foldMap (\(Builder _ x) -> x) builders instance Semigroup Builder