Permalink
Browse files

Fix benchmark build with older bytestring

--HG--
extra : amend_source : c1a49357128d6784becacab023c114fceee98abf
  • Loading branch information...
1 parent 1d7b92c commit 08e397bbebca5d75562f616e1783f0aac2e8d3b5 @bos committed Jan 9, 2014
Showing with 6 additions and 0 deletions.
  1. +6 −0 benchmarks/CompareWithJSON.hs
@@ -46,11 +46,13 @@ decodeA s = case A.decode s of
encodeJ :: J.JSValue -> BL.ByteString
encodeJ = toLazyByteString . fromString . J.encode
+#if MIN_VERSION_bytestring(0,10,4)
encodeToText :: A.Value -> TL.Text
encodeToText = TLB.toLazyText . A.encodeToTextBuilder . A.toJSON
encodeViaText :: A.Value -> BL.ByteString
encodeViaText = TLE.encodeUtf8 . encodeToText
+#endif
main :: IO ()
main = do
@@ -74,14 +76,18 @@ main = do
, bgroup "encode" [
bgroup "en" [
bench "aeson-to-bytestring" $ nf A.encode (decodeA enA)
+#if MIN_VERSION_bytestring(0,10,4)
, bench "aeson-via-text-to-bytestring" $ nf encodeViaText (decodeA enA)
, bench "aeson-to-text" $ nf encodeToText (decodeA enA)
+#endif
, bench "json" $ nf encodeJ (decodeJ enJ)
]
, bgroup "jp" [
bench "aeson-to-bytestring" $ nf A.encode (decodeA jpA)
+#if MIN_VERSION_bytestring(0,10,4)
, bench "aeson-via-text-to-bytestring" $ nf encodeViaText (decodeA jpA)
, bench "aeson-to-text" $ nf encodeToText (decodeA jpA)
+#endif
, bench "json" $ nf encodeJ (decodeJ jpJ)
]
]

0 comments on commit 08e397b

Please sign in to comment.