on master help sign in
Make a sandalone fold executable.
9797d76adithyaov
benchmark/lib/Streamly/Benchmark/Data/Fold.hs → benchmark/Streamly/Benchmark/Data/Fold.hsrenamed+27−7
@@ -7,12 +7,7 @@
7
7
8{-# LANGUAGE FlexibleContexts #-}
8{-# LANGUAGE FlexibleContexts #-}
9
9
10−module Streamly.Benchmark.Data.Fold
11− ( o_1_space_serial_folds
12− , o_1_space_serial_foldsTransforms
13− , o_1_space_serial_foldsCompositions
14− , o_n_heap_serial_folds
15− ) where
10+module Main (main) where
16
11
17import Control.DeepSeq (NFData(..))
12import Control.DeepSeq (NFData(..))
18import Data.Monoid (Last(..))
13import Data.Monoid (Last(..))
@@ -20,7 +15,7 @@ import Data.Monoid (Last(..))
20import System.Random (randomRIO)
15import System.Random (randomRIO)
21import Prelude (IO, Int, Double, String, (>), (<*>), (<$>), (+), ($),
16import Prelude (IO, Int, Double, String, (>), (<*>), (<$>), (+), ($),
22 (<=), Monad(..), (==), Maybe(..), (.), fromIntegral,
17 (<=), Monad(..), (==), Maybe(..), (.), fromIntegral,
23− compare, (>=))
18+ compare, (>=), concat, seq)
24
19
25import qualified Streamly as S hiding (runStream)
20import qualified Streamly as S hiding (runStream)
26import qualified Streamly.Prelude as S
21import qualified Streamly.Prelude as S
@@ -36,6 +31,7 @@ import qualified Streamly.Internal.Prelude as IP
36
31
37import Gauge
32import Gauge
38import Streamly hiding (runStream)
33import Streamly hiding (runStream)
34+import Streamly.Benchmark.Common
39
35
40-- We need a monadic bind here to make sure that the function f does not get
36-- We need a monadic bind here to make sure that the function f does not get
41-- completely optimized out by the compiler in some cases.
37-- completely optimized out by the compiler in some cases.
@@ -208,3 +204,27 @@ o_n_heap_serial_folds value =
208 ]
204 ]
209 ]
205 ]
210 ]
206 ]
207+
208+-------------------------------------------------------------------------------
209+-- Driver
210+-------------------------------------------------------------------------------
211+
212+main :: IO ()
213+main = do
214+ (value, cfg, benches) <- parseCLIOpts defaultStreamSize
215+ value `seq` runMode (mode cfg) cfg benches (allBenchmarks value)
216+ where
217+ allBenchmarks value =
218+ [ bgroup
219+ "o-1-space"
220+ [ bgroup "fold" $
221+ concat
222+ [ o_1_space_serial_folds value
223+ , o_1_space_serial_foldsTransforms value
224+ , o_1_space_serial_foldsCompositions value
225+ ]
226+ ]
227+ , bgroup
228+ "o-n-heap"
229+ [bgroup "fold" $ concat [o_n_heap_serial_folds value]]
230+ ]
benchmark/Streamly/Benchmark/Prelude/Serial/O_1_Space.hs−4
@@ -7,7 +7,6 @@
7
7
8import Streamly.Benchmark.Common
8import Streamly.Benchmark.Common
9import Streamly.Benchmark.Prelude
9import Streamly.Benchmark.Prelude
10−import Streamly.Benchmark.Data.Fold
11
10
12import Gauge
11import Gauge
13
12
@@ -34,10 +33,7 @@ main = do
34 , o_1_space_serial_foldable value
33 , o_1_space_serial_foldable value
35 , o_1_space_serial_generation value
34 , o_1_space_serial_generation value
36 , o_1_space_serial_elimination value
35 , o_1_space_serial_elimination value
37− , o_1_space_serial_folds value
38 , o_1_space_serial_foldMultiStream value
36 , o_1_space_serial_foldMultiStream value
39− , o_1_space_serial_foldsTransforms value
40− , o_1_space_serial_foldsCompositions value
41 , o_1_space_serial_pipes value
37 , o_1_space_serial_pipes value
42 , o_1_space_serial_pipesX4 value
38 , o_1_space_serial_pipesX4 value
43 , o_1_space_serial_transformer value
39 , o_1_space_serial_transformer value
benchmark/Streamly/Benchmark/Prelude/Serial/O_n_Heap.hs−2
@@ -7,7 +7,6 @@
7
7
8import Streamly.Benchmark.Common
8import Streamly.Benchmark.Common
9import Streamly.Benchmark.Prelude
9import Streamly.Benchmark.Prelude
10−import Streamly.Benchmark.Data.Fold
11
10
12import Gauge
11import Gauge
13
12
@@ -28,5 +27,4 @@ main = do
28 concat
27 concat
29 [ o_n_heap_serial_foldl size
28 [ o_n_heap_serial_foldl size
30 , o_n_heap_serial_buffering size
29 , o_n_heap_serial_buffering size
31− , o_n_heap_serial_folds size
32 ]
30 ]
benchmark/streamly-benchmarks.cabal+12−1
@@ -137,7 +137,6 @@ library lib-prelude
137 hs-source-dirs: lib, .
137 hs-source-dirs: lib, .
138 exposed-modules:
138 exposed-modules:
139 Streamly.Benchmark.Prelude
139 Streamly.Benchmark.Prelude
140− , Streamly.Benchmark.Data.Fold
141 other-modules: Streamly.Benchmark.Common
140 other-modules: Streamly.Benchmark.Common
142 , NestedOps
141 , NestedOps
143 , NestedUnfoldOps
142 , NestedUnfoldOps
@@ -226,6 +225,18 @@ benchmark serial-o-n-space
226 build-depends: lib-prelude
225 build-depends: lib-prelude
227 buildable: True
226 buildable: True
228
227
228+-- XXX Default memory restriction = o-1-space
229+benchmark fold
230+ import: bench-options
231+ type: exitcode-stdio-1.0
232+ ghc-options: -with-rtsopts "-T -K36K -M16M"
233+ hs-source-dirs: ., Streamly/Benchmark/Data
234+ main-is: Fold.hs
235+ if impl(ghcjs)
236+ buildable: False
237+ else
238+ buildable: True
239+
229-------------------------------------------------------------------------------
240-------------------------------------------------------------------------------
230-- Raw Streams
241-- Raw Streams
231-------------------------------------------------------------------------------
242-------------------------------------------------------------------------------
streamly.cabal−1
@@ -123,7 +123,6 @@ extra-source-files:
123 benchmark/README.md
123 benchmark/README.md
124 benchmark/*.hs
124 benchmark/*.hs
125 benchmark/lib/Streamly/Benchmark/*.hs
125 benchmark/lib/Streamly/Benchmark/*.hs
126− benchmark/lib/Streamly/Benchmark/Data/*.hs
127 benchmark/Streamly/Benchmark/Data/*.hs
126 benchmark/Streamly/Benchmark/Data/*.hs
128 benchmark/Streamly/Benchmark/Data/Prim/*.hs
127 benchmark/Streamly/Benchmark/Data/Prim/*.hs
129 benchmark/Streamly/Benchmark/Data/Stream/*.hs
128 benchmark/Streamly/Benchmark/Data/Stream/*.hs