on master help sign in
Merge all the Serial/* benchmarks into Serial.hs
commit9abd8b84b6a38d4c93c07d12ee7694a4572397d7 authoradithyaov <adi.obilisetty@gmail.com> dateTue 28 Apr 2020, 06:40 (6 years ago) parentb5cf9dd
8 files changed+80−189
bench.sh+12 benchmark/Streamly/Benchmark/Prelude/Serial.hs+64 benchmark/Streamly/Benchmark/Prelude/Serial/O_1_Space.hs−59 benchmark/Streamly/Benchmark/Prelude/Serial/O_n_Heap.hs−30 benchmark/Streamly/Benchmark/Prelude/Serial/O_n_Space.hs−31 benchmark/Streamly/Benchmark/Prelude/Serial/O_n_Stack.hs−26 benchmark/streamly-benchmarks.cabal+4−42 streamly.cabal−1
bench.sh+12
@@ -30,6 +30,10 @@ bench_rts_opts () {
3030 "fold-o-n-heap") echo -n "-T -K36K -M128M" ;;
3131 "unfold-o-1-space") echo -n "-T -K36K -M16M" ;;
3232 "unfold-o-n-space") echo -n "-T -K32M -M64M" ;;
33+ "linear") echo -n "-T -K36K -M16M" ;;
34+ "serial-o-n-stack") echo -n "-T -K1M -M16M" ;;
35+ "serial-o-n-heap") echo -n "-T -K36K -M128M" ;;
36+ "serial-o-n-space") echo -n "-T -K16M -M64M" ;;
3337 *) echo -n "" ;;
3438 esac
3539}
@@ -41,6 +45,10 @@ bench_exec () {
4145 "fold-o-n-heap") echo -n "fold" ;;
4246 "unfold-o-1-space") echo -n "unfold" ;;
4347 "unfold-o-n-space") echo -n "unfold" ;;
48+ "linear") echo -n "serial" ;;
49+ "serial-o-n-stack") echo -n "serial" ;;
50+ "serial-o-n-heap") echo -n "serial" ;;
51+ "serial-o-n-space") echo -n "serial" ;;
4452 *) echo -n "$1" ;;
4553 esac
4654}
@@ -52,6 +60,10 @@ bench_gauge_opts () {
5260 "fold-o-n-heap") echo -n "-m prefix o-n-heap" ;;
5361 "unfold-o-1-space") echo -n "-m prefix o-1-space" ;;
5462 "unfold-o-n-space") echo -n "-m prefix o-n-space" ;;
63+ "linear") echo -n "-m prefix o-1-space" ;;
64+ "serial-o-n-stack") echo -n "-m prefix o-n-stack" ;;
65+ "serial-o-n-heap") echo -n "-m prefix o-n-heap" ;;
66+ "serial-o-n-space") echo -n "-m prefix o-n-space" ;;
5567 *) echo -n "" ;;
5668 esac
5769}
benchmark/Streamly/Benchmark/Prelude/Serial.hsnew file+64
@@ -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]
benchmark/Streamly/Benchmark/Prelude/Serial/O_1_Space.hsdeleted−59
@@ -1,59 +0,0 @@
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− value `seq` runMode (mode cfg) cfg benches (allBenchmarks value)
20−
21− where
22−
23− allBenchmarks value =
24− concat
25− [ serial value
26− , wSerial value
27− , zipSerial value
28− ]
29−
30− serial value =
31− concat
32− [ o_1_space_serial_pure value
33− , o_1_space_serial_foldable value
34− , o_1_space_serial_generation value
35− , o_1_space_serial_elimination value
36− , o_1_space_serial_foldMultiStream value
37− , o_1_space_serial_pipes value
38− , o_1_space_serial_pipesX4 value
39− , o_1_space_serial_transformer value
40− , o_1_space_serial_transformation value
41− , o_1_space_serial_transformationX4 value
42− , o_1_space_serial_filtering value
43− , o_1_space_serial_filteringX4 value
44− , o_1_space_serial_joining value
45− , o_1_space_serial_concatFoldable value
46− , o_1_space_serial_concatSerial value
47− , o_1_space_serial_outerProductStreams value
48− , o_1_space_serial_mixed value
49− , o_1_space_serial_mixedX4 value
50− ]
51−
52− wSerial value =
53− concat
54− [ o_1_space_wSerial_transformation value
55− , o_1_space_wSerial_concatMap value
56− , o_1_space_wSerial_outerProduct value
57− ]
58−
59− zipSerial value = concat [o_1_space_zipSerial_transformation value]
benchmark/Streamly/Benchmark/Prelude/Serial/O_n_Heap.hsdeleted−30
@@ -1,30 +0,0 @@
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−
22− where
23−
24− -- Operations using O(1) stack space and O(n) heap space.
25− -- Tail recursive left folds
26− allBenchmarks size =
27− concat
28− [ o_n_heap_serial_foldl size
29− , o_n_heap_serial_buffering size
30− ]
benchmark/Streamly/Benchmark/Prelude/Serial/O_n_Space.hsdeleted−31
@@ -1,31 +0,0 @@
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−
22− where
23−
24− allBenchmarks size =
25− concat
26− [ o_n_space_serial_toContainers size -- < 2MB
27− , o_n_space_serial_outerProductStreams size
28− , o_n_space_wSerial_outerProductStreams size
29− , o_n_space_serial_traversable size -- < 2MB
30− , o_n_space_serial_foldr size
31− ]
benchmark/Streamly/Benchmark/Prelude/Serial/O_n_Stack.hsdeleted−26
@@ -1,26 +0,0 @@
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−
22− where
23−
24− -- Operations using O(n) stack space but O(1) heap space.
25− -- Head recursive operations.
26− allBenchmarks = o_n_stack_serial_iterated
benchmark/streamly-benchmarks.cabal+4−42
@@ -156,7 +156,6 @@ library lib-prelude
156156
157157common bench-options
158158 import: compile-options, optimization-options, bench-depends
159− ghc-options: -with-rtsopts "-T -K32K -M16M"
160159 build-depends: streamly-benchmarks
161160
162161-- Some benchmarks are threaded some are not
@@ -175,49 +174,12 @@ common bench-options-threaded
175174-- Serial Streams
176175-------------------------------------------------------------------------------
177176
178−benchmark linear
179−-- benchmark serial-o-1-space
177+benchmark serial
180178 import: bench-options
181179 type: exitcode-stdio-1.0
182− ghc-options: -with-rtsopts "-T -K36K -M16M"
183− hs-source-dirs: Streamly/Benchmark/Prelude/Serial
184− main-is: O_1_Space.hs
185− if impl(ghcjs)
186− buildable: False
187− else
188− build-depends: lib-prelude
189− buildable: True
190−
191−benchmark serial-o-n-heap
192− import: bench-options
193− type: exitcode-stdio-1.0
194− ghc-options: -with-rtsopts "-T -K36K -M128M"
195− hs-source-dirs: Streamly/Benchmark/Prelude/Serial
196− main-is: O_n_Heap.hs
197− if impl(ghcjs)
198− buildable: False
199− else
200− build-depends: lib-prelude
201− buildable: True
202−
203−benchmark serial-o-n-stack
204− import: bench-options
205− type: exitcode-stdio-1.0
206− ghc-options: -with-rtsopts "-T -K1M -M16M"
207− hs-source-dirs: Streamly/Benchmark/Prelude/Serial
208− main-is: O_n_Stack.hs
209− if impl(ghcjs)
210− buildable: False
211− else
212− build-depends: lib-prelude
213− buildable: True
214−
215−benchmark serial-o-n-space
216− import: bench-options
217− type: exitcode-stdio-1.0
218− ghc-options: -with-rtsopts "-T -K16M -M64M"
219− hs-source-dirs: Streamly/Benchmark/Prelude/Serial
220− main-is: O_n_Space.hs
180+ ghc-options: -rtsopts
181+ hs-source-dirs: Streamly/Benchmark/Prelude
182+ main-is: Serial.hs
221183 if impl(ghcjs)
222184 buildable: False
223185 else
streamly.cabal−1
@@ -144,7 +144,6 @@ extra-source-files:
144144 benchmark/Streamly/Benchmark/Data/Stream/*.hs
145145 benchmark/Streamly/Benchmark/FileIO/*.hs
146146 benchmark/Streamly/Benchmark/Prelude/*.hs
147− benchmark/Streamly/Benchmark/Prelude/Serial/*.hs
148147
149148extra-tmp-files:
150149 config.log