Skip to content

Commit f8b5fbc

Browse files
committed
benchmarks/aeson: update for aeson-2
1 parent cd5dd47 commit f8b5fbc

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

benchmarks/aeson/template.hs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,15 @@ module NAME
1010
#endif
1111

1212
import Data.Aeson
13+
import qualified Data.Aeson.Key as Key
14+
import qualified Data.Aeson.KeyMap as KM
1315
import qualified Data.ByteString.Lazy as L
14-
import qualified Data.HashMap.Strict as H
1516
import Data.Monoid
1617
import qualified Data.Scientific as Sci
1718
import qualified Data.Text as T
1819
import qualified Data.Text.Encoding as T
1920
import qualified Data.Vector as V
21+
import GHC.Exts (inline)
2022

2123
import LIB
2224

@@ -51,8 +53,8 @@ fromNumber :: Sci.Scientific -> Builder
5153
fromNumber = either doubleDec integerDec . Sci.floatingOrInteger
5254

5355
fromObject :: Object -> Builder
54-
fromObject obj = char8 '{' <> H.foldMapWithKey f obj <> char8 '}'
56+
fromObject obj = char8 '{' <> inline KM.foldMapWithKey f obj <> char8 '}'
5557
where
5658
f k v =
57-
fromString k <> char8 ':' <> fromValue v
59+
fromString (Key.toText k) <> char8 ':' <> fromValue v
5860
<> char8 ','

fast-builder.cabal

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,8 @@ benchmark aeson
3636
hs-source-dirs: benchmarks/aeson
3737
other-modules: Fast, Bstr
3838
include-dirs: benchmarks/aeson
39-
build-depends: base, fast-builder, aeson, criterion, bytestring,
40-
scientific, text, vector, deepseq, ghc-prim, template-haskell,
41-
unordered-containers >= 0.2.11.0
39+
build-depends: base, fast-builder, aeson >= 2, criterion, bytestring,
40+
scientific, text, vector, deepseq, ghc-prim
4241
ghc-options: -fsimpl-tick-factor=120
4342
ghc-options: -Wall -threaded -g -rtsopts
4443
default-language: Haskell2010

0 commit comments

Comments
 (0)