on master help sign in
Fix naming changes in benchmarks
commitc8b32f2a53af931bd4f5daf42b23d9701754c190 authorHarendra Kumar <harendra.kumar@gmail.com> dateSun 13 May 2018, 10:27 (8 years ago) parentc9277a8
4 files changed+75−62
benchmark/Linear.hs+5−5 benchmark/LinearOps.hs+2−2 benchmark/Nested.hs+57−44 benchmark/NestedOps.hs+11−11
benchmark/Linear.hs+5−5
@@ -50,11 +50,11 @@ main = do
5050 ]
5151 , benchIO "zip" Ops.zip
5252 , bgroup "append"
53− [ benchIOAppend "stream" $ Ops.append asStream
54− , benchIOAppend "costream" $ Ops.append asCostream
55− , benchIOAppend "parAhead" $ Ops.append asParAhead
56− , benchIOAppend "coparAhead" $ Ops.append asCoparAhead
57− , benchIOAppend "parallel" $ Ops.append asParallel
53+ [ benchIOAppend "serially" $ Ops.append serially
54+ , benchIOAppend "wSerially" $ Ops.append wSerially
55+ , benchIOAppend "asyncly" $ Ops.append asyncly
56+ , benchIOAppend "wAsyncly" $ Ops.append wAsyncly
57+ , benchIOAppend "parallely" $ Ops.append parallely
5858 ]
5959 , bgroup "compose"
6060 [ benchIO "mapM" Ops.composeMapM
benchmark/LinearOps.hs+2−2
@@ -59,7 +59,7 @@ last :: Monad m => Stream m Int -> m (Maybe Int)
5959-- Stream generation and elimination
6060-------------------------------------------------------------------------------
6161
62−type Stream m a = S.StreamT m a
62+type Stream m a = S.SerialT m a
6363
6464source :: Int -> Stream m Int
6565source n = S.fromFoldable [n..n+value]
@@ -111,7 +111,7 @@ concat _n = return ()
111111{-# INLINE append #-}
112112append
113113 :: (Monoid (t m Int), Monad m, Monad (t m))
114− => (t m Int -> S.StreamT m Int) -> Int -> m ()
114+ => (t m Int -> S.SerialT m Int) -> Int -> m ()
115115append t n = runStream $ t $ foldMap return [n..n+appendValue]
116116
117117-------------------------------------------------------------------------------
benchmark/Nested.hs+57−44
@@ -27,55 +27,68 @@ main = do
2727 , benchIO "toListLinear" Ops.toListLinear
2828 ]
2929
30− , bgroup "asStream"
31− [ benchIO "append" $ Ops.append asStream
32− , benchIO "toNull0" $ Ops.toNull0 asStream
33− , benchIO "toList0" $ Ops.toList0 asStream
34− , benchIO "toNull" $ Ops.toNull asStream
35− , benchIO "toList" $ Ops.toList asStream
36− , benchIO "toListSome" $ Ops.toListSome asStream
37− , benchIO "filterAllOut" $ Ops.filterAllOut asStream
38− , benchIO "filterAllIn" $ Ops.filterAllIn asStream
39− , benchIO "filterSome" $ Ops.filterSome asStream
40− , benchIO "breakAfterSome" $ Ops.breakAfterSome asStream
30+ , bgroup "serially"
31+ [ benchIO "append" $ Ops.append serially
32+ , benchIO "toNull0" $ Ops.toNull0 serially
33+ , benchIO "toList0" $ Ops.toList0 serially
34+ , benchIO "toNull" $ Ops.toNull serially
35+ , benchIO "toList" $ Ops.toList serially
36+ , benchIO "toListSome" $ Ops.toListSome serially
37+ , benchIO "filterAllOut" $ Ops.filterAllOut serially
38+ , benchIO "filterAllIn" $ Ops.filterAllIn serially
39+ , benchIO "filterSome" $ Ops.filterSome serially
40+ , benchIO "breakAfterSome" $ Ops.breakAfterSome serially
4141 ]
4242
43− , bgroup "asCostream"
44− [ benchIO "append" $ Ops.append asCostream
45− , benchIO "toNull0" $ Ops.toNull0 asCostream
46− , benchIO "toList0" $ Ops.toList0 asCostream
47− , benchIO "toNull" $ Ops.toNull asCostream
48− , benchIO "toList" $ Ops.toList asCostream
49− , benchIO "toListSome" $ Ops.toListSome asCostream
50− , benchIO "filterAllOut" $ Ops.filterAllOut asCostream
51− , benchIO "filterAllIn" $ Ops.filterAllIn asCostream
52− , benchIO "filterSome" $ Ops.filterSome asCostream
53− , benchIO "breakAfterSome" $ Ops.breakAfterSome asCostream
43+ , bgroup "wSerially"
44+ [ benchIO "append" $ Ops.append wSerially
45+ , benchIO "toNull0" $ Ops.toNull0 wSerially
46+ , benchIO "toList0" $ Ops.toList0 wSerially
47+ , benchIO "toNull" $ Ops.toNull wSerially
48+ , benchIO "toList" $ Ops.toList wSerially
49+ , benchIO "toListSome" $ Ops.toListSome wSerially
50+ , benchIO "filterAllOut" $ Ops.filterAllOut wSerially
51+ , benchIO "filterAllIn" $ Ops.filterAllIn wSerially
52+ , benchIO "filterSome" $ Ops.filterSome wSerially
53+ , benchIO "breakAfterSome" $ Ops.breakAfterSome wSerially
5454 ]
5555
56− , bgroup "CoasCoparAhead"
57− [ benchIO "append" $ Ops.append asParAhead
58− , benchIO "toNull0" $ Ops.toNull0 asParAhead
59− , benchIO "toList0" $ Ops.toList0 asParAhead
60− , benchIO "toNull" $ Ops.toNull asParAhead
61− , benchIO "toList" $ Ops.toList asParAhead
62− , benchIO "toListSome" $ Ops.toListSome asParAhead
63− , benchIO "filterAllOut" $ Ops.filterAllOut asParAhead
64− , benchIO "filterAllIn" $ Ops.filterAllIn asParAhead
65− , benchIO "filterSome" $ Ops.filterSome asParAhead
66− , benchIO "breakAfterSome" $ Ops.breakAfterSome asParAhead
56+ , bgroup "asyncly"
57+ [ benchIO "append" $ Ops.append asyncly
58+ , benchIO "toNull0" $ Ops.toNull0 asyncly
59+ , benchIO "toList0" $ Ops.toList0 asyncly
60+ , benchIO "toNull" $ Ops.toNull asyncly
61+ , benchIO "toList" $ Ops.toList asyncly
62+ , benchIO "toListSome" $ Ops.toListSome asyncly
63+ , benchIO "filterAllOut" $ Ops.filterAllOut asyncly
64+ , benchIO "filterAllIn" $ Ops.filterAllIn asyncly
65+ , benchIO "filterSome" $ Ops.filterSome asyncly
66+ , benchIO "breakAfterSome" $ Ops.breakAfterSome asyncly
6767 ]
6868
69− , bgroup "Parallely"
70− [ benchIO "append" $ Ops.append asCoparAhead
71− , benchIO "toNull0" $ Ops.toNull0 asCoparAhead
72− , benchIO "toList0" $ Ops.toList0 asCoparAhead
73− , benchIO "toNull" $ Ops.toNull asCoparAhead
74− , benchIO "toList" $ Ops.toList asCoparAhead
75− , benchIO "toListSome" $ Ops.toListSome asCoparAhead
76− , benchIO "filterAllOut" $ Ops.filterAllOut asCoparAhead
77− , benchIO "filterAllIn" $ Ops.filterAllIn asCoparAhead
78− , benchIO "filterSome" $ Ops.filterSome asCoparAhead
79− , benchIO "breakAfterSome" $ Ops.breakAfterSome asCoparAhead
69+ , bgroup "wAsyncly"
70+ [ benchIO "append" $ Ops.append wAsyncly
71+ , benchIO "toNull0" $ Ops.toNull0 wAsyncly
72+ , benchIO "toList0" $ Ops.toList0 wAsyncly
73+ , benchIO "toNull" $ Ops.toNull wAsyncly
74+ , benchIO "toList" $ Ops.toList wAsyncly
75+ , benchIO "toListSome" $ Ops.toListSome wAsyncly
76+ , benchIO "filterAllOut" $ Ops.filterAllOut wAsyncly
77+ , benchIO "filterAllIn" $ Ops.filterAllIn wAsyncly
78+ , benchIO "filterSome" $ Ops.filterSome wAsyncly
79+ , benchIO "breakAfterSome" $ Ops.breakAfterSome wAsyncly
80+ ]
81+
82+ , bgroup "parallely"
83+ [ benchIO "append" $ Ops.append parallely
84+ , benchIO "toNull0" $ Ops.toNull0 parallely
85+ , benchIO "toList0" $ Ops.toList0 parallely
86+ , benchIO "toNull" $ Ops.toNull parallely
87+ , benchIO "toList" $ Ops.toList parallely
88+ , benchIO "toListSome" $ Ops.toListSome parallely
89+ , benchIO "filterAllOut" $ Ops.filterAllOut parallely
90+ , benchIO "filterAllIn" $ Ops.filterAllIn parallely
91+ , benchIO "filterSome" $ Ops.filterSome parallely
92+ , benchIO "breakAfterSome" $ Ops.breakAfterSome parallely
8093 ]
8194 ]
benchmark/NestedOps.hs+11−11
@@ -25,7 +25,7 @@ prodCount = 1000
2525-- Stream generation and elimination
2626-------------------------------------------------------------------------------
2727
28−type Stream m a = S.StreamT m a
28+type Stream m a = S.SerialT m a
2929
3030{-# INLINE source #-}
3131source :: S.IsStream t => Int -> Int -> t m Int
@@ -54,13 +54,13 @@ toListLinear start = runToList $ source start sumCount
5454{-# INLINE append #-}
5555append
5656 :: (Monoid (t m Int), Monad m, Monad (t m))
57− => (t m Int -> S.StreamT m Int) -> Int -> m ()
57+ => (t m Int -> S.SerialT m Int) -> Int -> m ()
5858append t start = runStream $ t $ foldMap return [start..start+sumCount]
5959
6060{-# INLINE toNull0 #-}
6161toNull0
6262 :: (S.IsStream t, Monad m, Monad (t m))
63− => (t m (Int, Int) -> S.StreamT m (Int, Int)) -> Int -> m ()
63+ => (t m (Int, Int) -> S.SerialT m (Int, Int)) -> Int -> m ()
6464toNull0 t start = runStream . t $ do
6565 x <- source start prodCount
6666 y <- source start prodCount
@@ -69,7 +69,7 @@ toNull0 t start = runStream . t $ do
6969{-# INLINE toList0 #-}
7070toList0
7171 :: (S.IsStream t, Monad m, Monad (t m))
72− => (t m (Int, Int) -> S.StreamT m (Int, Int)) -> Int -> m [(Int, Int)]
72+ => (t m (Int, Int) -> S.SerialT m (Int, Int)) -> Int -> m [(Int, Int)]
7373toList0 t start = runToList . t $ do
7474 x <- source start prodCount
7575 y <- source start prodCount
@@ -78,7 +78,7 @@ toList0 t start = runToList . t $ do
7878{-# INLINE toNull #-}
7979toNull
8080 :: (S.IsStream t, Monad m, Monad (t m))
81− => (t m Int -> S.StreamT m Int) -> Int -> m ()
81+ => (t m Int -> S.SerialT m Int) -> Int -> m ()
8282toNull t start = runStream . t $ do
8383 x <- source start prodCount
8484 y <- source start prodCount
@@ -87,7 +87,7 @@ toNull t start = runStream . t $ do
8787{-# INLINE toList #-}
8888toList
8989 :: (S.IsStream t, Monad m, Monad (t m))
90− => (t m Int -> S.StreamT m Int) -> Int -> m [Int]
90+ => (t m Int -> S.SerialT m Int) -> Int -> m [Int]
9191toList t start = runToList . t $ do
9292 x <- source start prodCount
9393 y <- source start prodCount
@@ -96,7 +96,7 @@ toList t start = runToList . t $ do
9696{-# INLINE toListSome #-}
9797toListSome
9898 :: (S.IsStream t, Monad m, Monad (t m))
99− => (t m Int -> S.StreamT m Int) -> Int -> m [Int]
99+ => (t m Int -> S.SerialT m Int) -> Int -> m [Int]
100100toListSome t start =
101101 runToList . t $ S.take 1000 $ do
102102 x <- source start prodCount
@@ -106,7 +106,7 @@ toListSome t start =
106106{-# INLINE filterAllOut #-}
107107filterAllOut
108108 :: (S.IsStream t, Monad m, Monad (t m))
109− => (t m Int -> S.StreamT m Int) -> Int -> m ()
109+ => (t m Int -> S.SerialT m Int) -> Int -> m ()
110110filterAllOut t start = runStream . t $ do
111111 x <- source start prodCount
112112 y <- source start prodCount
@@ -118,7 +118,7 @@ filterAllOut t start = runStream . t $ do
118118{-# INLINE filterAllIn #-}
119119filterAllIn
120120 :: (S.IsStream t, Monad m, Monad (t m))
121− => (t m Int -> S.StreamT m Int) -> Int -> m ()
121+ => (t m Int -> S.SerialT m Int) -> Int -> m ()
122122filterAllIn t start = runStream . t $ do
123123 x <- source start prodCount
124124 y <- source start prodCount
@@ -130,7 +130,7 @@ filterAllIn t start = runStream . t $ do
130130{-# INLINE filterSome #-}
131131filterSome
132132 :: (S.IsStream t, Monad m, Monad (t m))
133− => (t m Int -> S.StreamT m Int) -> Int -> m ()
133+ => (t m Int -> S.SerialT m Int) -> Int -> m ()
134134filterSome t start = runStream . t $ do
135135 x <- source start prodCount
136136 y <- source start prodCount
@@ -142,7 +142,7 @@ filterSome t start = runStream . t $ do
142142{-# INLINE breakAfterSome #-}
143143breakAfterSome
144144 :: (S.IsStream t, Monad (t IO))
145− => (t IO Int -> S.StreamT IO Int) -> Int -> IO ()
145+ => (t IO Int -> S.SerialT IO Int) -> Int -> IO ()
146146breakAfterSome t start = do
147147 (_ :: Either ErrorCall ()) <- try $ runStream . t $ do
148148 x <- source start prodCount