on master help sign in
Basic benchmark (#24)
550e061Index Int
.travis.yml+2−1
@@ -16,7 +16,8 @@ install:
16 - stack install --only-dependencies --no-terminal
16 - stack install --only-dependencies --no-terminal
17
17
18script:
18script:
19− - stack test :regression --coverage --no-terminal --ghc-options -Werror
19+ - stack test ether:regression --coverage --no-terminal --ghc-options -Werror
20+ - stack bench ether:bench --no-terminal --ghc-options -Werror
20
21
21after_script:
22after_script:
22 - curl -L https://github.com/rubik/stack-hpc-coveralls/releases/download/v0.0.3.0/shc-linux-x64-7.10.2.tar.bz2 | tar -xvj
23 - curl -L https://github.com/rubik/stack-hpc-coveralls/releases/download/v0.0.3.0/shc-linux-x64-7.10.2.tar.bz2 | tar -xvj
bench/Bench.hsnew file+79
@@ -0,0 +1,79 @@
1+{-# LANGUAGE TypeApplications #-}
2+{-# LANGUAGE FlexibleContexts #-}
3+{-# LANGUAGE DataKinds #-}
4+
5+module Main (main) where
6+
7+import Criterion.Main
8+import qualified Control.Monad.Reader as M
9+import qualified Control.Monad.Ether.Reader as E
10+import qualified Control.Lens as L
11+
12+readerSummatorMTL_flat_9
13+ :: M.MonadReader (Int, Int, Int, Int, Int, Int, Int, Int, Int) m
14+ => m String
15+readerSummatorMTL_flat_9 = do
16+ concat <$> sequenceA
17+ [ show <$> L.view L._1
18+ , show <$> L.view L._2
19+ , show <$> L.view L._3
20+ , show <$> L.view L._4
21+ , show <$> L.view L._5
22+ , show <$> L.view L._6
23+ , show <$> L.view L._7
24+ , show <$> L.view L._8
25+ , show <$> L.view L._9 ]
26+{-# NOINLINE readerSummatorMTL_flat_9 #-}
27+
28+run_readerSummatorMTL_flat_9 :: (Int, Int, Int, Int, Int, Int, Int, Int, Int) -> String
29+run_readerSummatorMTL_flat_9
30+ (a1, a2, a3, a4, a5, a6, a7, a8, a9)
31+ = M.runReader readerSummatorMTL_flat_9
32+ $ (a9, a8, a7, a6, a5, a4, a3, a2, a1)
33+
34+readerSummatorEther_sep_9
35+ :: ( E.MonadReader 1 Int m
36+ , E.MonadReader 2 Int m
37+ , E.MonadReader 3 Int m
38+ , E.MonadReader 4 Int m
39+ , E.MonadReader 5 Int m
40+ , E.MonadReader 6 Int m
41+ , E.MonadReader 7 Int m
42+ , E.MonadReader 8 Int m
43+ , E.MonadReader 9 Int m )
44+ => m String
45+readerSummatorEther_sep_9 = concat <$> sequenceA
46+ [ show <$> E.ask @1
47+ , show <$> E.ask @2
48+ , show <$> E.ask @3
49+ , show <$> E.ask @4
50+ , show <$> E.ask @5
51+ , show <$> E.ask @6
52+ , show <$> E.ask @7
53+ , show <$> E.ask @8
54+ , show <$> E.ask @9 ]
55+{-# NOINLINE readerSummatorEther_sep_9 #-}
56+
57+run_readerSummatorEther_nested_9 :: (Int, Int, Int, Int, Int, Int, Int, Int, Int) -> String
58+run_readerSummatorEther_nested_9
59+ (a1, a2, a3, a4, a5, a6, a7, a8, a9)
60+ = flip (E.runReader @9) a1
61+ . flip (E.runReaderT @8) a2
62+ . flip (E.runReaderT @7) a3
63+ . flip (E.runReaderT @6) a4
64+ . flip (E.runReaderT @5) a5
65+ . flip (E.runReaderT @4) a6
66+ . flip (E.runReaderT @3) a7
67+ . flip (E.runReaderT @2) a8
68+ . flip (E.runReaderT @1) a9
69+ $ readerSummatorEther_sep_9
70+
71+tuple_9 :: (Int, Int, Int, Int, Int, Int, Int, Int, Int)
72+tuple_9 = (1, -2, 3, -4, 5, -6, 7, -8, 9)
73+
74+main :: IO ()
75+main = do
76+ defaultMain
77+ [ bench "readerSummatorMTL_flat_9" $ nf run_readerSummatorMTL_flat_9 tuple_9
78+ , bench "readerSummatorEther_nested_9" $ nf run_readerSummatorEther_nested_9 tuple_9
79+ ]
ether.cabal+19−3
@@ -57,7 +57,7 @@ library
57
57
58 other-modules: Control.Monad.Ether.State.Common
58 other-modules: Control.Monad.Ether.State.Common
59
59
60− build-depends: base >=4.7 && <4.10
60+ build-depends: base >=4.9 && <4.10
61 , transformers >=0.4.2
61 , transformers >=0.4.2
62 , transformers-lift >=0.1.0.1
62 , transformers-lift >=0.1.0.1
63 , mtl >=2.2.1
63 , mtl >=2.2.1
@@ -89,7 +89,7 @@ library
89
89
90test-suite regression
90test-suite regression
91
91
92− build-depends: base >=4.7 && <4.10
92+ build-depends: base >=4.9 && <4.10
93 , transformers >=0.4.2
93 , transformers >=0.4.2
94 , mtl >=2.2.1
94 , mtl >=2.2.1
95 , tasty >=0.10
95 , tasty >=0.10
@@ -125,5 +125,21 @@ test-suite regression
125 TypeApplications
125 TypeApplications
126 TypeFamilies
126 TypeFamilies
127 TypeOperators
127 TypeOperators
128− QuasiQuotes
129 ghc-options: -Wall -fno-warn-missing-signatures
128 ghc-options: -Wall -fno-warn-missing-signatures
129+
130+
131+benchmark bench
132+
133+ build-depends: base >=4.9 && <4.10
134+ , mtl >=2.2.1
135+ , transformers >=0.4.2
136+ , criterion >=1.1
137+ , lens >=4.14
138+ , ether
139+
140+ main-is: Bench.hs
141+
142+ type: exitcode-stdio-1.0
143+ hs-source-dirs: bench
144+ default-language: Haskell2010
145+ ghc-options: -Wall -O2
stack.yaml+53−7
@@ -1,22 +1,69 @@
1+compiler-check: match-exact
2+resolver: ghc-8.0.0.20160421
3+setup-info:
4+ ghc:
5+ linux64:
6+ 8.0.0.20160421:
7+ url: https://downloads.haskell.org/~ghc/8.0.1-rc4/ghc-8.0.0.20160421-x86_64-unknown-linux.tar.xz
8+
1packages:
9packages:
2- '.'
10- '.'
11+
3extra-deps:
12extra-deps:
13+- Glob-0.7.5
4- QuickCheck-2.8.2
14- QuickCheck-2.8.2
15+- StateVar-1.1.0.4
16+- abstract-deque-0.3
17+- abstract-par-0.3.3
18+- adjunctions-4.3
19+- aeson-0.11.2.0
5- ansi-terminal-0.6.2.3
20- ansi-terminal-0.6.2.3
6- ansi-wl-pprint-0.6.7.3
21- ansi-wl-pprint-0.6.7.3
7- async-2.1.0
22- async-2.1.0
23+- attoparsec-0.13.0.2
24+- base-orphans-0.5.4
25+- bifunctors-5.3
26+- blaze-builder-0.4.0.2
27+- cassava-0.4.5.0
28+- cereal-0.5.1.0
8- clock-0.7.2
29- clock-0.7.2
30+- comonad-5
31+- contravariant-1.4
32+- criterion-1.1.1.0
33+- distributive-0.5.0.2
34+- dlist-0.7.1.2
35+- erf-2.0.0.0
9- exceptions-0.8.2.1
36- exceptions-0.8.2.1
37+- fail-4.9.0.0
38+- free-4.12.4
39+- hashable-1.2.4.0
40+- hastache-0.6.1
41+- ieee754-0.7.8
42+- kan-extensions-5.0.1
43+- lens-4.14
44+- math-functions-0.1.6.0
10- mmorph-1.0.6
45- mmorph-1.0.6
11- monad-control-1.0.1.0
46- monad-control-1.0.1.0
47+- monad-par-0.3.4.7
48+- monad-par-extras-0.3.3
12- mtl-2.2.1
49- mtl-2.2.1
50+- mwc-random-0.13.4.0
13- optparse-applicative-0.12.1.0
51- optparse-applicative-0.12.1.0
52+- parallel-3.2.1.0
14- parsec-3.1.9
53- parsec-3.1.9
54+- prelude-extras-0.4.0.3
15- primitive-0.6.1.0
55- primitive-0.6.1.0
56+- profunctors-5.2
16- random-1.1
57- random-1.1
58+- reflection-2.1.2
17- regex-base-0.93.2
59- regex-base-0.93.2
18- regex-tdfa-1.2.2
60- regex-tdfa-1.2.2
61+- scientific-0.3.4.6
62+- semigroupoids-5.0.1
63+- semigroups-0.18.1
64+- statistics-0.13.2.3
19- stm-2.4.4.1
65- stm-2.4.4.1
66+- syb-0.6
20- tagged-0.8.4
67- tagged-0.8.4
21- tasty-0.11.0.3
68- tasty-0.11.0.3
22- tasty-quickcheck-0.8.4
69- tasty-quickcheck-0.8.4
@@ -26,10 +73,9 @@ extra-deps:
26- transformers-compat-0.5.1.4
73- transformers-compat-0.5.1.4
27- transformers-lift-0.1.0.1
74- transformers-lift-0.1.0.1
28- unbounded-delays-0.1.0.9
75- unbounded-delays-0.1.0.9
29−compiler-check: match-exact
76+- unordered-containers-0.2.7.0
30−resolver: ghc-8.0.0.20160421
77+- vector-0.11.0.0
31−setup-info:
78+- vector-algorithms-0.7.0.1
32− ghc:
79+- vector-binary-instances-0.2.3.2
33− linux64:
80+- vector-th-unbox-0.2.1.6
34− 8.0.0.20160421:
81+- void-0.7.1
35− url: https://downloads.haskell.org/~ghc/8.0.1-rc4/ghc-8.0.0.20160421-x86_64-unknown-linux.tar.xz