@@ -7,12 +7,7 @@
77
88{-# LANGUAGE FlexibleContexts #-}
99
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
1611
1712import Control.DeepSeq (NFData(..))
1813import Data.Monoid (Last(..))
@@ -20,7 +15,7 @@ import Data.Monoid (Last(..))
2015import System.Random (randomRIO)
2116import Prelude (IO, Int, Double, String, (>), (<*>), (<$>), (+), ($),
2217 (<=), Monad(..), (==), Maybe(..), (.), fromIntegral,
23− compare, (>=))
18+ compare, (>=), concat, seq)
2419
2520import qualified Streamly as S hiding (runStream)
2621import qualified Streamly.Prelude as S
@@ -36,6 +31,7 @@ import qualified Streamly.Internal.Prelude as IP
3631
3732import Gauge
3833import Streamly hiding (runStream)
34+import Streamly.Benchmark.Common
3935
4036-- We need a monadic bind here to make sure that the function f does not get
4137-- completely optimized out by the compiler in some cases.
@@ -208,3 +204,27 @@ o_n_heap_serial_folds value =
208204 ]
209205 ]
210206 ]
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+ ]