aeson 1.5.4.0 → 1.5.4.1
raw patch · 4 files changed
+21/−5 lines, 4 filesdep ~bytestringdep ~generic-derivingdep ~th-abstractionPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: bytestring, generic-deriving, th-abstraction
API changes (from Hackage documentation)
Files
- Data/Aeson/Parser/Internal.hs +7/−1
- aeson.cabal +4/−4
- changelog.md +4/−0
- ffi/Data/Aeson/Parser/UnescapeFFI.hs +6/−0
Data/Aeson/Parser/Internal.hs view
@@ -322,13 +322,19 @@ -- not sure whether >= or bit hackery is faster -- perfectly, we shouldn't care, it's compiler job. s <- A.takeWhile (\w -> w /= DOUBLE_QUOTE && w /= BACKSLASH && w >= 0x20 && w < 0x80)- let txt = TE.decodeUtf8 s+ let txt = unsafeDecodeASCII s mw <- A.peekWord8 case mw of Nothing -> fail "string without end" Just DOUBLE_QUOTE -> A.anyWord8 $> txt Just w | w < 0x20 -> fail "unescaped control character" _ -> jstringSlow s++-- | The input is assumed to contain only 7bit ASCII characters (i.e. @< 0x80@).+-- We use TE.decodeLatin1 here because TE.decodeASCII is currently (text-1.2.4.0)+-- deprecated and equal to TE.decodeUtf8, which is slower than TE.decodeLatin1.+unsafeDecodeASCII :: B.ByteString -> Text+unsafeDecodeASCII = TE.decodeLatin1 jstringSlow :: B.ByteString -> Parser Text {-# INLINE jstringSlow #-}
aeson.cabal view
@@ -1,5 +1,5 @@ name: aeson-version: 1.5.4.0+version: 1.5.4.1 license: BSD3 license-file: LICENSE category: Text, Web, JSON@@ -100,7 +100,7 @@ -- GHC bundled libs build-depends: base >= 4.7.0.0 && < 5,- bytestring >= 0.10.4.0 && < 0.11,+ bytestring >= 0.10.4.0 && < 0.12, containers >= 0.5.5.1 && < 0.7, deepseq >= 1.3.0.0 && < 1.5, ghc-prim >= 0.2 && < 0.8,@@ -143,7 +143,7 @@ scientific >= 0.3.6.2 && < 0.4, strict >= 0.4 && < 0.5, tagged >= 0.8.6 && < 0.9,- th-abstraction >= 0.2.8.0 && < 0.4,+ th-abstraction >= 0.2.8.0 && < 0.5, these >= 1.1 && < 1.2, unordered-containers >= 0.2.10.0 && < 0.3, uuid-types >= 1.0.3 && < 1.1,@@ -217,7 +217,7 @@ dlist, Diff >= 0.4 && < 0.5, filepath,- generic-deriving >= 1.10 && < 1.14,+ generic-deriving >= 1.10 && < 1.15, ghc-prim >= 0.2, hashable >= 1.2.4.0, scientific,
changelog.md view
@@ -1,5 +1,9 @@ For the latest version of this document, please see [https://github.com/bos/aeson/blob/master/changelog.md](https://github.com/bos/aeson/blob/master/changelog.md). +#### 1.5.4.1+* Use `Text.Encoding.decodeLatin1` to speed up ASCII string decoding, thanks to Dmitry Ivanov.+* Support `bytestring 0.11.*` and `th-abstraction 0.4.*`, thanks to Oleg Grenrus.+ ### 1.5.4.0 * Add instances for `ToJSONKey` and `FromJSONKey` to `Const`, thanks to Dan Fithian.
ffi/Data/Aeson/Parser/UnescapeFFI.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} {-# LANGUAGE ForeignFunctionInterface #-} {-# LANGUAGE MagicHash #-} {-# LANGUAGE UnliftedFFITypes #-}@@ -29,7 +30,12 @@ -> Ptr Word8 -> Ptr Word8 -> IO CInt unescapeText' :: ByteString -> Text+#if MIN_VERSION_bytestring(0,11,0)+unescapeText' (BS fp len) = runText $ \done -> do+ let off = 0+#else unescapeText' (PS fp off len) = runText $ \done -> do+#endif let go dest = withForeignPtr fp $ \ptr -> with (0::CSize) $ \destOffPtr -> do let end = ptr `plusPtr` (off + len)