bytestring-strict-builder 0.4.5.6 → 0.4.5.7
raw patch · 7 files changed
+102/−60 lines, 7 filesdep −QuickCheckdep −tasty-hunitdep ~bytestringdep ~criterionPVP ok
version bump matches the API change (PVP)
Dependencies removed: QuickCheck, tasty-hunit
Dependency ranges changed: bytestring, criterion
API changes (from Hackage documentation)
Files
- benchmarks/Main.hs +1/−0
- bytestring-strict-builder.cabal +80/−42
- library/ByteString/StrictBuilder.hs +5/−5
- library/ByteString/StrictBuilder/Population.hs +4/−2
- library/ByteString/StrictBuilder/Population/UncheckedShifting.hs +1/−0
- library/ByteString/StrictBuilder/Prelude.hs +1/−1
- tests/Main.hs +10/−10
benchmarks/Main.hs view
@@ -4,6 +4,7 @@ import Criterion.Main import Prelude hiding (concat) +main :: IO () main = defaultMain [leftAppends, rightAppends, concat, copy]
bytestring-strict-builder.cabal view
@@ -1,7 +1,8 @@-name: bytestring-strict-builder-version: 0.4.5.6-category: Text, ByteString, Builders, Serialization-synopsis: An efficient strict bytestring builder+cabal-version: 3.0+name: bytestring-strict-builder+version: 0.4.5.7+category: Text, ByteString, Builders, Serialization+synopsis: An efficient strict bytestring builder description: According to <https://github.com/nikita-volkov/bytestring-builders-benchmark the competition benchmarks>, @@ -11,58 +12,95 @@ 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\".-homepage: https://github.com/nikita-volkov/bytestring-strict-builder-bug-reports: https://github.com/nikita-volkov/bytestring-strict-builder/issues-author: Nikita Volkov <nikita.y.volkov@mail.ru>-maintainer: Nikita Volkov <nikita.y.volkov@mail.ru>-copyright: (c) 2017, Nikita Volkov-license: MIT-license-file: LICENSE-build-type: Simple-cabal-version: >=1.10 +homepage: https://github.com/nikita-volkov/bytestring-strict-builder+bug-reports:+ https://github.com/nikita-volkov/bytestring-strict-builder/issues++author: Nikita Volkov <nikita.y.volkov@mail.ru>+maintainer: Nikita Volkov <nikita.y.volkov@mail.ru>+copyright: (c) 2017, Nikita Volkov+license: MIT+license-file: LICENSE+ source-repository head- type: git- location: git://github.com/nikita-volkov/bytestring-strict-builder.git+ type: git+ location:+ git://github.com/nikita-volkov/bytestring-strict-builder.git +common base+ default-language: Haskell2010+ default-extensions:+ NoImplicitPrelude+ NoMonomorphismRestriction+ Arrows+ BangPatterns+ ConstraintKinds+ DataKinds+ DefaultSignatures+ DeriveDataTypeable+ DeriveFoldable+ DeriveFunctor+ DeriveGeneric+ DeriveTraversable+ EmptyDataDecls+ FlexibleContexts+ FlexibleInstances+ FunctionalDependencies+ GADTs+ GeneralizedNewtypeDeriving+ LambdaCase+ LiberalTypeSynonyms+ MagicHash+ MultiParamTypeClasses+ MultiWayIf+ OverloadedStrings+ ParallelListComp+ PatternGuards+ QuasiQuotes+ RankNTypes+ RecordWildCards+ ScopedTypeVariables+ StandaloneDeriving+ TemplateHaskell+ TupleSections+ TypeFamilies+ TypeOperators+ UnboxedTuples+ library- hs-source-dirs: library- default-extensions: Arrows, BangPatterns, ConstraintKinds, DataKinds, DefaultSignatures, DeriveDataTypeable, DeriveFoldable, DeriveFunctor, DeriveGeneric, DeriveTraversable, EmptyDataDecls, FlexibleContexts, FlexibleInstances, FunctionalDependencies, GADTs, GeneralizedNewtypeDeriving, LambdaCase, LiberalTypeSynonyms, MagicHash, MultiParamTypeClasses, MultiWayIf, NoImplicitPrelude, NoMonomorphismRestriction, OverloadedStrings, PatternGuards, ParallelListComp, QuasiQuotes, RankNTypes, RecordWildCards, ScopedTypeVariables, StandaloneDeriving, TemplateHaskell, TupleSections, TypeFamilies, TypeOperators, UnboxedTuples- default-language: Haskell2010- exposed-modules:- ByteString.StrictBuilder+ import: base+ hs-source-dirs: library+ exposed-modules: ByteString.StrictBuilder other-modules:- ByteString.StrictBuilder.Prelude ByteString.StrictBuilder.Population ByteString.StrictBuilder.Population.UncheckedShifting+ ByteString.StrictBuilder.Prelude ByteString.StrictBuilder.UTF8+ build-depends:- base >=4.11 && <5,- bytestring >=0.10.2 && <0.12+ , base >=4.11 && <5+ , bytestring >=0.10.2 && <0.13 test-suite tests- type: exitcode-stdio-1.0+ import: base+ type: exitcode-stdio-1.0 hs-source-dirs: tests- main-is: Main.hs- default-extensions: Arrows, BangPatterns, ConstraintKinds, DataKinds, DefaultSignatures, DeriveDataTypeable, DeriveFoldable, DeriveFunctor, DeriveGeneric, DeriveTraversable, EmptyDataDecls, FlexibleContexts, FlexibleInstances, FunctionalDependencies, GADTs, GeneralizedNewtypeDeriving, LambdaCase, LiberalTypeSynonyms, MagicHash, MultiParamTypeClasses, MultiWayIf, NoImplicitPrelude, NoMonomorphismRestriction, OverloadedStrings, PatternGuards, ParallelListComp, QuasiQuotes, RankNTypes, RecordWildCards, ScopedTypeVariables, StandaloneDeriving, TemplateHaskell, TupleSections, TypeFamilies, TypeOperators, UnboxedTuples- default-language: Haskell2010+ main-is: Main.hs build-depends:- bytestring-strict-builder,- QuickCheck >=2.8.1 && <3,- quickcheck-instances >=0.3.11 && <0.4,- rerebase >=1.10 && <2,- tasty >=1.4 && <2,- tasty-hunit >=0.10 && <0.11,- tasty-quickcheck >=0.10 && <0.11+ , bytestring-strict-builder+ , quickcheck-instances >=0.3.11 && <0.4+ , rerebase >=1.10 && <2+ , tasty >=1.4 && <2+ , tasty-quickcheck >=0.10 && <0.11 benchmark benchmarks- type: exitcode-stdio-1.0+ import: base+ type: exitcode-stdio-1.0 hs-source-dirs: benchmarks- main-is: Main.hs- ghc-options: -O2 -threaded "-with-rtsopts=-N" -funbox-strict-fields- default-extensions: Arrows, BangPatterns, ConstraintKinds, DataKinds, DefaultSignatures, DeriveDataTypeable, DeriveFoldable, DeriveFunctor, DeriveTraversable, DeriveGeneric, EmptyDataDecls, FlexibleContexts, FlexibleInstances, FunctionalDependencies, GADTs, GeneralizedNewtypeDeriving, LambdaCase, LiberalTypeSynonyms, MagicHash, MultiParamTypeClasses, MultiWayIf, NoImplicitPrelude, NoMonomorphismRestriction, OverloadedStrings, PatternGuards, ParallelListComp, QuasiQuotes, RankNTypes, RecordWildCards, ScopedTypeVariables, StandaloneDeriving, TemplateHaskell, TupleSections, TypeFamilies, TypeOperators, UnboxedTuples- default-language: Haskell2010+ main-is: Main.hs+ ghc-options: -O2 -threaded -with-rtsopts=-N -funbox-strict-fields build-depends:- bytestring-strict-builder,- criterion >=1.5.9 && <1.6,- rerebase >=1.10 && <2+ , bytestring-strict-builder+ , criterion >=1.6 && <2+ , rerebase >=1.10 && <2
library/ByteString/StrictBuilder.hs view
@@ -132,15 +132,15 @@ ------------------------- {-# INLINEABLE asciiIntegral #-}-asciiIntegral :: Integral a => a -> Builder+asciiIntegral :: (Integral a) => a -> Builder asciiIntegral = \case 0 -> byte 48 x ->- bool ((<>) (byte 45)) id (x >= 0) $- loop mempty $- abs x+ bool ((<>) (byte 45)) id (x >= 0)+ $ loop mempty+ $ abs x where loop builder remainder = case remainder of@@ -157,7 +157,7 @@ byte . fromIntegral . ord {-# INLINE CONLIKE storable #-}-storable :: Storable a => a -> Builder+storable :: (Storable a) => a -> Builder storable value = Builder size (A.storable size value) where
library/ByteString/StrictBuilder/Population.hs view
@@ -1,4 +1,5 @@ {-# LANGUAGE CPP #-}+{-# OPTIONS_GHC -Wno-unused-imports #-} module ByteString.StrictBuilder.Population where @@ -8,6 +9,7 @@ import qualified Data.ByteString.Builder.Internal as G import qualified Data.ByteString.Internal as B import qualified Data.ByteString.Lazy.Internal as C+import Foreign.Marshal.Utils newtype Population = Population {populationPtrUpdate :: Ptr Word8 -> IO (Ptr Word8)} @@ -54,10 +56,10 @@ bytes (B.PS foreignPointer offset length) = Population $ \ptr -> withForeignPtr foreignPointer $ \ptr' ->- B.memcpy ptr (plusPtr ptr' offset) length $> plusPtr ptr length+ copyBytes ptr (plusPtr ptr' offset) length $> plusPtr ptr length {-# INLINE storable #-}-storable :: Storable a => Int -> a -> Population+storable :: (Storable a) => Int -> a -> Population storable size value = Population (\ptr -> poke (castPtr ptr) value $> plusPtr ptr size)
library/ByteString/StrictBuilder/Population/UncheckedShifting.hs view
@@ -1,4 +1,5 @@ {-# LANGUAGE CPP #-}+{-# OPTIONS_GHC -Wno-unused-imports #-} -- | -- Copyright : (c) 2010 Simon Meier
library/ByteString/StrictBuilder/Prelude.hs view
@@ -26,7 +26,7 @@ import Data.Fixed as Exports import Data.Foldable as Exports hiding (toList) import Data.Function as Exports hiding (id, (.))-import Data.Functor as Exports+import Data.Functor as Exports hiding (unzip) import Data.Functor.Compose as Exports import Data.IORef as Exports import Data.Int as Exports
tests/Main.hs view
@@ -2,25 +2,25 @@ import qualified ByteString.StrictBuilder as B import qualified Data.ByteString as A-import Test.QuickCheck.Instances+import Test.QuickCheck.Instances () import Test.Tasty-import Test.Tasty.HUnit import Test.Tasty.QuickCheck import Prelude +main :: IO () main =- defaultMain $- testGroup "All tests" $- [ testProperty "Packing a list of bytes is isomorphic to appending a list of builders" $- \byteList ->+ defaultMain+ $ testGroup "All tests"+ $ [ testProperty "Packing a list of bytes is isomorphic to appending a list of builders"+ $ \byteList -> A.pack byteList === B.builderBytes (foldMap B.word8 byteList),- testProperty "Concatting a list of bytestrings is isomorphic to fold-mapping with builders" $- \bytesList ->+ testProperty "Concatting a list of bytestrings is isomorphic to fold-mapping with builders"+ $ \bytesList -> mconcat bytesList === B.builderBytes (foldMap B.bytes bytesList),- testProperty "Concatting a list of bytestrings is isomorphic to concatting a list of builders" $- \bytesList ->+ testProperty "Concatting a list of bytestrings is isomorphic to concatting a list of builders"+ $ \bytesList -> mconcat bytesList === B.builderBytes (mconcat (map B.bytes bytesList)) ]