File tree Expand file tree Collapse file tree 4 files changed +63
-6
lines changed Expand file tree Collapse file tree 4 files changed +63
-6
lines changed Original file line number Diff line number Diff line change @@ -13,4 +13,7 @@ main = defaultMain [
13
13
Generic. benchmarks
14
14
, Manual. benchmarks
15
15
, TH. benchmarks
16
+ , Generic. decodeBenchmarks
17
+ , Manual. decodeBenchmarks
18
+ , TH. decodeBenchmarks
16
19
]
Original file line number Diff line number Diff line change 1
1
{-# LANGUAGE PackageImports #-}
2
- module Typed.Generic (benchmarks ) where
2
+ module Typed.Generic (benchmarks , decodeBenchmarks ) where
3
3
4
4
import Prelude ()
5
5
import Prelude.Compat
@@ -26,7 +26,7 @@ encodeViaValueB = B.encode . B.toJSON
26
26
benchmarks :: Benchmark
27
27
benchmarks =
28
28
env ((,) <$> load " json-data/twitter100.json" <*> load " json-data/jp100.json" ) $ \ ~ (twitter100, jp100) ->
29
- bgroup " generic " [
29
+ bgroup " encodeGeneric " [
30
30
bgroup " direct" [
31
31
bench " twitter100" $ nf encodeDirectB twitter100
32
32
, bench " jp100" $ nf encodeDirectB jp100
@@ -40,3 +40,21 @@ benchmarks =
40
40
, bench " jp100 baseline" $ nf encodeViaValueA jp100
41
41
]
42
42
]
43
+
44
+ decodeDirectA :: L. ByteString -> Maybe Result
45
+ decodeDirectA = decode
46
+
47
+ decodeDirectB :: L. ByteString -> Maybe Result
48
+ decodeDirectB = B. decode
49
+
50
+ decodeBenchmarks :: Benchmark
51
+ decodeBenchmarks =
52
+ env ((,) <$> L. readFile " json-data/twitter100.json" <*> L. readFile " json-data/jp100.json" ) $ \ ~ (twitter100, jp100) ->
53
+ bgroup " decodeGeneric"
54
+ [ bgroup " direct"
55
+ [ bench " twitter100" $ nf decodeDirectB twitter100
56
+ , bench " jp100" $ nf decodeDirectB jp100
57
+ , bench " twitter100 baseline" $ nf decodeDirectA twitter100
58
+ , bench " jp100 baseline" $ nf decodeDirectA jp100
59
+ ]
60
+ ]
Original file line number Diff line number Diff line change 1
1
{-# LANGUAGE PackageImports #-}
2
- module Typed.Manual (benchmarks ) where
2
+ module Typed.Manual (benchmarks , decodeBenchmarks ) where
3
3
4
4
import Prelude ()
5
5
import Prelude.Compat
@@ -26,7 +26,7 @@ encodeViaValueB = B.encode . B.toJSON
26
26
benchmarks :: Benchmark
27
27
benchmarks =
28
28
env ((,) <$> load " json-data/twitter100.json" <*> load " json-data/jp100.json" ) $ \ ~ (twitter100, jp100) ->
29
- bgroup " manual " [
29
+ bgroup " encodeManual " [
30
30
bgroup " direct" [
31
31
bench " twitter100" $ nf encodeDirectB twitter100
32
32
, bench " jp100" $ nf encodeDirectB jp100
@@ -40,3 +40,21 @@ benchmarks =
40
40
, bench " jp100 baseline" $ nf encodeViaValueA jp100
41
41
]
42
42
]
43
+
44
+ decodeDirectA :: L. ByteString -> Maybe Result
45
+ decodeDirectA = decode
46
+
47
+ decodeDirectB :: L. ByteString -> Maybe Result
48
+ decodeDirectB = B. decode
49
+
50
+ decodeBenchmarks :: Benchmark
51
+ decodeBenchmarks =
52
+ env ((,) <$> L. readFile " json-data/twitter100.json" <*> L. readFile " json-data/jp100.json" ) $ \ ~ (twitter100, jp100) ->
53
+ bgroup " decodeManual"
54
+ [ bgroup " direct"
55
+ [ bench " twitter100" $ nf decodeDirectB twitter100
56
+ , bench " jp100" $ nf decodeDirectB jp100
57
+ , bench " twitter100 baseline" $ nf decodeDirectA twitter100
58
+ , bench " jp100 baseline" $ nf decodeDirectA jp100
59
+ ]
60
+ ]
Original file line number Diff line number Diff line change 1
1
{-# LANGUAGE PackageImports #-}
2
- module Typed.TH (benchmarks ) where
2
+ module Typed.TH (benchmarks , decodeBenchmarks ) where
3
3
4
4
import Prelude ()
5
5
import Prelude.Compat
@@ -26,7 +26,7 @@ encodeViaValueB = B.encode . B.toJSON
26
26
benchmarks :: Benchmark
27
27
benchmarks =
28
28
env ((,) <$> load " json-data/twitter100.json" <*> load " json-data/jp100.json" ) $ \ ~ (twitter100, jp100) ->
29
- bgroup " th " [
29
+ bgroup " encodeTH " [
30
30
bgroup " direct" [
31
31
bench " twitter100" $ nf encodeDirectB twitter100
32
32
, bench " jp100" $ nf encodeDirectB jp100
@@ -40,3 +40,21 @@ benchmarks =
40
40
, bench " jp100 baseline" $ nf encodeViaValueB jp100
41
41
]
42
42
]
43
+
44
+ decodeDirectA :: L. ByteString -> Maybe Result
45
+ decodeDirectA = decode
46
+
47
+ decodeDirectB :: L. ByteString -> Maybe Result
48
+ decodeDirectB = B. decode
49
+
50
+ decodeBenchmarks :: Benchmark
51
+ decodeBenchmarks =
52
+ env ((,) <$> L. readFile " json-data/twitter100.json" <*> L. readFile " json-data/jp100.json" ) $ \ ~ (twitter100, jp100) ->
53
+ bgroup " decodeTH"
54
+ [ bgroup " direct"
55
+ [ bench " twitter100" $ nf decodeDirectB twitter100
56
+ , bench " jp100" $ nf decodeDirectB jp100
57
+ , bench " twitter100 baseline" $ nf decodeDirectA twitter100
58
+ , bench " jp100 baseline" $ nf decodeDirectA jp100
59
+ ]
60
+ ]
You can’t perform that action at this time.
0 commit comments