@@ -0,0 +1,64 @@
1+-- |
2+-- Module : Main
3+-- Copyright : (c) 2018 Harendra Kumar
4+--
5+-- License : BSD3
6+-- Maintainer : streamly@composewell.com
7+
8+import Streamly.Benchmark.Common
9+import Streamly.Benchmark.Prelude
10+
11+import Gauge
12+
13+-- In addition to gauge options, the number of elements in the stream can be
14+-- passed using the --stream-size option.
15+--
16+main :: IO ()
17+main = do
18+ (value, cfg, benches) <- parseCLIOpts defaultStreamSize
19+ size <- limitStreamSize value
20+ size `seq` runMode (mode cfg) cfg benches (allBenchmarks size)
21+ where
22+ allBenchmarks size =
23+ [ bgroup "o-n-stack" $ o_n_stack_serial_iterated size
24+ , bgroup "o-1-space" $
25+ concat [serial size, wSerial size, zipSerial size]
26+ , bgroup "o-n-heap" $
27+ concat [o_n_heap_serial_foldl size, o_n_heap_serial_buffering size]
28+ , bgroup "o-n-space" $
29+ concat
30+ [ o_n_space_serial_toList size -- < 2MB
31+ , o_n_space_serial_outerProductStreams size
32+ , o_n_space_wSerial_outerProductStreams size
33+ , o_n_space_serial_traversable size -- < 2MB
34+ , o_n_space_serial_foldr size
35+ ]
36+ ]
37+ serial size =
38+ concat
39+ [ o_1_space_serial_pure size
40+ , o_1_space_serial_foldable size
41+ , o_1_space_serial_generation size
42+ , o_1_space_serial_elimination size
43+ , o_1_space_serial_foldMultiStream size
44+ , o_1_space_serial_pipes size
45+ , o_1_space_serial_pipesX4 size
46+ , o_1_space_serial_transformer size
47+ , o_1_space_serial_transformation size
48+ , o_1_space_serial_transformationX4 size
49+ , o_1_space_serial_filtering size
50+ , o_1_space_serial_filteringX4 size
51+ , o_1_space_serial_joining size
52+ , o_1_space_serial_concatFoldable size
53+ , o_1_space_serial_concatSerial size
54+ , o_1_space_serial_outerProductStreams size
55+ , o_1_space_serial_mixed size
56+ , o_1_space_serial_mixedX4 size
57+ ]
58+ wSerial size =
59+ concat
60+ [ o_1_space_wSerial_transformation size
61+ , o_1_space_wSerial_concatMap size
62+ , o_1_space_wSerial_outerProduct size
63+ ]
64+ zipSerial size = concat [o_1_space_zipSerial_transformation size]