pinch 0.3.0.0 → 0.3.0.1
raw patch · 4 files changed
+52/−23 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- CHANGES.md +10/−0
- bench/pinch-bench/Bench.hs +39/−20
- pinch.cabal +1/−1
- src/Pinch/Internal/Bits.hs +2/−2
CHANGES.md view
@@ -1,9 +1,19 @@+0.3.0.1 (2016-07-12)+====================++- Compile on 32-bit systems.+ 0.3.0.0 (2016-06-02) ==================== - Add support for the Thrift Compact Protocol (#2). - Add support for returning the leftover ByteString when parsing Thrift payloads (#3).++0.2.0.2 (2016-07-12)+====================++- Compile on 32-bit systems. 0.2.0.1 (2016-05-23) ====================
bench/pinch-bench/Bench.hs view
@@ -152,38 +152,57 @@ main :: IO () main = defaultMain [ bgroup "A"- [ env (generate :: IO A) $ \a -> bench "encode" $ whnf encode a- , env generateEncodedA $ \bs -> bench "decode" $- nf (P.decode P.binaryProtocol :: ByteString -> Either String A) bs+ [ env (generate :: IO A) $ \a -> bgroup "encode"+ [ bench "binary" $ whnf (P.encode P.binaryProtocol) a+ , bench "compact" $ whnf (P.encode P.compactProtocol) a+ ]+ , bgroup "decode"+ [ env (generateEncodedA P.binaryProtocol) $ \bs -> bench "binary" $+ nf (P.decode P.binaryProtocol :: ByteString -> Either String A) bs+ , env (generateEncodedA P.compactProtocol) $ \bs -> bench "compact" $+ nf (P.decode P.compactProtocol :: ByteString -> Either String A) bs+ ] ] , bgroup "NestedMixed"- [ env generateNestedMixedFields $ \ ~(f1, f2, f3) -> bench "encode" $- whnf encode (NestedMixed f1 f2 f3)- , env generateEncodedNestedMixed $ \bs -> bench "decode" $- nf (P.decode P.binaryProtocol :: ByteString -> Either String NestedMixed) bs+ [ env generateNestedMixedFields $ \ ~(f1, f2, f3) -> bgroup "encode"+ [ bench "binary" $+ whnf (P.encode P.binaryProtocol) (NestedMixed f1 f2 f3)+ , bench "compact" $+ whnf (P.encode P.compactProtocol) (NestedMixed f1 f2 f3)+ ]+ , bgroup "decode"+ [ env (generateEncodedNestedMixed P.binaryProtocol) $ \bs -> bench "binary" $+ nf (P.decode P.binaryProtocol :: ByteString -> Either String NestedMixed) bs+ , env (generateEncodedNestedMixed P.compactProtocol) $ \bs -> bench "compact" $+ nf (P.decode P.compactProtocol :: ByteString -> Either String NestedMixed) bs+ ]+ ] , bgroup "Struct"- [ env structFields $ \ ~(f1, f2, f3) -> bench "encode" $- whnf encode (Struct f1 f2 f3)- , env generateEncodedStruct $ \bs -> bench "deode" $- nf (P.decode P.binaryProtocol :: ByteString -> Either String Struct) bs+ [ env structFields $ \ ~(f1, f2, f3) -> bgroup "encode"+ [ bench "binary" $ whnf (P.encode P.binaryProtocol) (Struct f1 f2 f3)+ , bench "compact" $ whnf (P.encode P.compactProtocol) (Struct f1 f2 f3)+ ]+ , bgroup "decode"+ [ env (generateEncodedStruct P.binaryProtocol) $ \bs -> bench "binary" $+ nf (P.decode P.binaryProtocol :: ByteString -> Either String Struct) bs+ , env (generateEncodedStruct P.compactProtocol) $ \bs -> bench "compact" $+ nf (P.decode P.compactProtocol :: ByteString -> Either String Struct) bs+ ] ] ] where- generateEncodedNestedMixed = bracket_ stopProfTimer startProfTimer $ do+ generateEncodedNestedMixed proto = bracket_ stopProfTimer startProfTimer $ do (f1, f2, f3) <- generateNestedMixedFields- return $ P.encode P.binaryProtocol (NestedMixed f1 f2 f3)+ return $ P.encode proto (NestedMixed f1 f2 f3) - generateEncodedA = bracket_ stopProfTimer startProfTimer $ do+ generateEncodedA proto = bracket_ stopProfTimer startProfTimer $ do a <- generate :: IO A- return $ P.encode P.binaryProtocol a+ return $ P.encode proto a - generateEncodedStruct = bracket_ stopProfTimer startProfTimer $ do+ generateEncodedStruct proto = bracket_ stopProfTimer startProfTimer $ do (f1, f2, f3) <- structFields- return $ P.encode P.binaryProtocol (Struct f1 f2 f3)+ return $ P.encode proto (Struct f1 f2 f3) generate :: QC.Arbitrary a => IO a generate = QC.generate QC.arbitrary-- encode :: P.Pinchable a => a -> ByteString- encode = P.encode P.binaryProtocol
pinch.cabal view
@@ -3,7 +3,7 @@ -- see: https://github.com/sol/hpack name: pinch-version: 0.3.0.0+version: 0.3.0.1 cabal-version: >= 1.10 build-type: Simple license: BSD3
src/Pinch/Internal/Bits.hs view
@@ -18,7 +18,7 @@ #if defined(__GLASGOW_HASKELL__) && !defined(__HADDOCK__) import GHC.Base (Int (..), uncheckedShiftL#)-import GHC.Word (Word16 (..), Word32 (..), Word64 (..))+import GHC.Word (Word16 (..), Word32 (..), Word64 (..), uncheckedShiftL64#) #else import Data.Bits (shiftL) import Data.Word (Word16, Word32, Word64)@@ -38,7 +38,7 @@ #if defined(__GLASGOW_HASKELL__) && !defined(__HADDOCK__) w16ShiftL (W16# w) (I# i) = W16# (w `uncheckedShiftL#` i) w32ShiftL (W32# w) (I# i) = W32# (w `uncheckedShiftL#` i)-w64ShiftL (W64# w) (I# i) = W64# (w `uncheckedShiftL#` i)+w64ShiftL (W64# w) (I# i) = W64# (w `uncheckedShiftL64#` i) #else w16ShiftL = shiftL w32ShiftL = shiftL