on master help sign in
Reorganize benchmark modules

* move common modules to lib directory. This is required because otherwise cabal/ghc would try to use them directly and emit warnings about missing-modules. * move the prelude benchmark executables to Streamly/Benchmark/Prelude to be consistent with the organization of other modules.

commit0b00efe4f6279d632c5258228e2d551440fa8da9 authorHarendra Kumar <harendra.kumar@gmail.com> dateWed 19 Feb 2020, 02:07 (7 years ago) parentf65dda6
14 files changed+41−109
benchmark/LinearAsync.hs+1−1 benchmark/LinearRate.hs+1−1 benchmark/Nested.hs+1−1 benchmark/NestedConcurrent.hs+1−1 benchmark/NestedUnfold.hs+1−1 benchmark/Parallel.hs+1−1 benchmark/exe/Prelude/Serial/O_1_Space.hs → benchmark/Streamly/Benchmark/Prelude/Serial/O_1_Space.hs+1−1 benchmark/exe/Prelude/Serial/O_n_Heap.hs → benchmark/Streamly/Benchmark/Prelude/Serial/O_n_Heap.hs+1−1 benchmark/exe/Prelude/Serial/O_n_Space.hs → benchmark/Streamly/Benchmark/Prelude/Serial/O_n_Space.hs+1−1 benchmark/exe/Prelude/Serial/O_n_Stack.hs → benchmark/Streamly/Benchmark/Prelude/Serial/O_n_Stack.hs+1−2 benchmark/Common.hs → benchmark/lib/Streamly/Benchmark/Common.hs+2−2 benchmark/Streamly/Benchmark/Prelude.hs → benchmark/lib/Streamly/Benchmark/Prelude.hs benchmark/streamly-benchmarks.cabal+27−94 streamly.cabal+2−2
benchmark/LinearAsync.hs+1−1
@@ -10,7 +10,7 @@ import Control.DeepSeq (NFData)
1010-- import Data.Functor.Identity (Identity, runIdentity)
1111import System.Random (randomRIO)
1212
13−import Common (parseCLIOpts)
13+import Streamly.Benchmark.Common (parseCLIOpts)
1414
1515import Streamly
1616import Gauge
benchmark/LinearRate.hs+1−1
@@ -11,7 +11,7 @@
1111-- import Data.Functor.Identity (Identity, runIdentity)
1212import System.Random (randomRIO)
1313
14−import Common (parseCLIOpts)
14+import Streamly.Benchmark.Common (parseCLIOpts)
1515
1616import Streamly
1717import Gauge
benchmark/Nested.hs+1−1
@@ -9,7 +9,7 @@ import Control.DeepSeq (NFData)
99import Data.Functor.Identity (Identity, runIdentity)
1010import System.Random (randomRIO)
1111
12−import Common (parseCLIOpts)
12+import Streamly.Benchmark.Common (parseCLIOpts)
1313
1414import Streamly
1515import Gauge
benchmark/NestedConcurrent.hs+1−1
@@ -10,7 +10,7 @@ import Control.Monad (when)
1010import Data.Functor.Identity (Identity, runIdentity)
1111import System.Random (randomRIO)
1212
13−import Common (parseCLIOpts)
13+import Streamly.Benchmark.Common (parseCLIOpts)
1414
1515import Streamly
1616import Gauge
benchmark/NestedUnfold.hs+1−1
@@ -8,7 +8,7 @@
88import Control.DeepSeq (NFData)
99import System.Random (randomRIO)
1010
11−import Common (parseCLIOpts)
11+import Streamly.Benchmark.Common (parseCLIOpts)
1212
1313import qualified NestedUnfoldOps as Ops
1414
benchmark/Parallel.hs+1−1
@@ -10,7 +10,7 @@ import Control.DeepSeq (NFData)
1010-- import Data.Functor.Identity (Identity, runIdentity)
1111import System.Random (randomRIO)
1212
13−import Common (parseCLIOpts)
13+import Streamly.Benchmark.Common (parseCLIOpts)
1414
1515import Streamly
1616import Gauge
benchmark/exe/Prelude/Serial/O_1_Space.hs → benchmark/Streamly/Benchmark/Prelude/Serial/O_1_Space.hsrenamed+1−1
@@ -25,7 +25,7 @@ import qualified Streamly.Internal.Prelude as IP
2525import qualified Streamly.Internal.Data.Pipe as Pipe
2626
2727import Gauge
28−import Common
28+import Streamly.Benchmark.Common
2929
3030-------------------------------------------------------------------------------
3131--
benchmark/exe/Prelude/Serial/O_n_Heap.hs → benchmark/Streamly/Benchmark/Prelude/Serial/O_n_Heap.hsrenamed+1−1
@@ -21,7 +21,7 @@ import qualified Streamly.Internal.Prelude as IP
2121
2222import Gauge
2323import Streamly
24−import Common
24+import Streamly.Benchmark.Common
2525
2626-------------------------------------------------------------------------------
2727--
benchmark/exe/Prelude/Serial/O_n_Space.hs → benchmark/Streamly/Benchmark/Prelude/Serial/O_n_Space.hsrenamed+1−1
@@ -13,7 +13,7 @@ import qualified Streamly.Benchmark.Prelude as Ops
1313
1414import Streamly
1515import Gauge
16−import Common
16+import Streamly.Benchmark.Common
1717
1818-------------------------------------------------------------------------------
1919-- Benchmarking utilities
benchmark/exe/Prelude/Serial/O_n_Stack.hs → benchmark/Streamly/Benchmark/Prelude/Serial/O_n_Stack.hsrenamed+1−2
@@ -8,12 +8,11 @@
88import Control.DeepSeq (NFData(..))
99import System.Random (randomRIO)
1010
11−import Common -- (parseCLIOpts)
12−
1311import qualified Streamly.Benchmark.Prelude as Ops
1412
1513import Streamly
1614import Gauge
15+import Streamly.Benchmark.Common
1716
1817-------------------------------------------------------------------------------
1918--
benchmark/Common.hs → benchmark/lib/Streamly/Benchmark/Common.hsrenamed+2−2
@@ -4,13 +4,13 @@
44#endif
55
66-- |
7−-- Module : Main
7+-- Module : Streamly.Benchmark.Common
88-- Copyright : (c) 2019 Composewell Technologies
99--
1010-- License : BSD3
1111-- Maintainer : streamly@composewell.com
1212
13−module Common
13+module Streamly.Benchmark.Common
1414 ( parseCLIOpts
1515
1616 , benchIOSink1
benchmark/Streamly/Benchmark/Prelude.hs → benchmark/lib/Streamly/Benchmark/Prelude.hsrenamed

The content is the same.

benchmark/streamly-benchmarks.cabal+27−94
@@ -95,55 +95,6 @@ common optimization-options
9595common lib-options
9696 import: compile-options, optimization-options
9797
98−-------------------------------------------------------------------------------
99−-- Library
100−-------------------------------------------------------------------------------
101−
102−library
103− import: lib-options
104− hs-source-dirs: .
105− exposed-modules:
106− Common
107−
108− build-depends:
109− -- Core libraries shipped with ghc, the min and max
110− -- constraints of these libraries should match with
111− -- the GHC versions we support
112− base >= 4.8 && < 5
113− , deepseq >= 1.4.1 && < 1.5
114−
115− -- other libraries
116− , streamly >= 0.7.0
117− , gauge >= 0.2.4 && < 0.3
118− , random >= 1.0 && < 2.0
119−
120−library lib-prelude
121− import: lib-options
122− hs-source-dirs: .
123− exposed-modules:
124− Streamly.Benchmark.Prelude
125− build-depends:
126− -- Core libraries shipped with ghc, the min and max
127− -- constraints of these libraries should match with
128− -- the GHC versions we support
129− base >= 4.8 && < 5
130− , deepseq >= 1.4.1 && < 1.5
131− , mtl >= 2.2 && < 3
132−
133− -- other libraries
134− , streamly >= 0.7.0
135− if flag(inspection)
136− build-depends: template-haskell >= 2.14 && < 2.16
137− , inspection-testing >= 0.4 && < 0.5
138− -- Array uses a Storable constraint in dev build making several inspection
139− -- tests fail
140− if flag(dev) && flag(inspection)
141− build-depends: inspection-and-dev-flags-cannot-be-used-together
142−
143−-------------------------------------------------------------------------------
144−-- Benchmarks
145−-------------------------------------------------------------------------------
146−
14798common bench-depends
14899 build-depends:
149100 -- Core libraries shipped with ghc, the min and max
@@ -154,7 +105,6 @@ common bench-depends
154105 , mtl >= 2.2 && < 3
155106
156107 -- other libraries
157− , streamly-benchmarks
158108 , streamly >= 0.7.0
159109 , random >= 1.0 && < 2.0
160110 , gauge >= 0.2.4 && < 0.3
@@ -167,6 +117,25 @@ common bench-depends
167117 if flag(inspection)
168118 build-depends: template-haskell >= 2.14 && < 2.16
169119 , inspection-testing >= 0.4 && < 0.5
120+ -- Array uses a Storable constraint in dev build making several inspection
121+ -- tests fail
122+ if flag(dev) && flag(inspection)
123+ build-depends: inspection-and-dev-flags-cannot-be-used-together
124+
125+-------------------------------------------------------------------------------
126+-- Library
127+-------------------------------------------------------------------------------
128+
129+library
130+ import: lib-options, bench-depends
131+ hs-source-dirs: lib
132+ exposed-modules:
133+ Streamly.Benchmark.Common
134+ , Streamly.Benchmark.Prelude
135+
136+-------------------------------------------------------------------------------
137+-- Benchmarks
138+-------------------------------------------------------------------------------
170139
171140-- Whatever stack size below 32K we use GHC seems to report the stack size as
172141-- 32K at crash. Even K0K works. Therefore it probably does not make sense to
@@ -175,6 +144,8 @@ common bench-depends
175144common bench-options
176145 import: compile-options, optimization-options, bench-depends
177146 ghc-options: -with-rtsopts "-T -K32K -M16M"
147+ build-depends: streamly-benchmarks
148+ hs-source-dirs: .
178149
179150-- Some benchmarks are threaded some are not
180151common bench-options-threaded
@@ -182,6 +153,8 @@ common bench-options-threaded
182153 -- -threaded and -N2 is important because some GC and space leak issues
183154 -- trigger only with these options.
184155 ghc-options: -threaded -with-rtsopts "-T -N2 -K32K -M16M"
156+ build-depends: streamly-benchmarks
157+ hs-source-dirs: .
185158
186159-------------------------------------------------------------------------------
187160-- Serial Streams
@@ -192,50 +165,36 @@ benchmark linear
192165 import: bench-options
193166 type: exitcode-stdio-1.0
194167 ghc-options: -with-rtsopts "-T -K36K -M16M"
195− hs-source-dirs: exe
196− main-is: Prelude/Serial/O_1_Space.hs
197− build-depends:
198− lib-prelude
168+ main-is: Streamly/Benchmark/Prelude/Serial/O_1_Space.hs
199169
200170benchmark serial-O-n-heap
201171 import: bench-options
202172 type: exitcode-stdio-1.0
203173 ghc-options: -with-rtsopts "-T -K36K -M128M"
204− hs-source-dirs: exe
205− main-is: Prelude/Serial/O_n_Heap.hs
206− build-depends:
207− lib-prelude
174+ main-is: Streamly/Benchmark/Prelude/Serial/O_n_Heap.hs
208175
209176benchmark serial-O-n-stack
210177 import: bench-options
211178 type: exitcode-stdio-1.0
212179 ghc-options: -with-rtsopts "-T -K1M -M16M"
213− hs-source-dirs: exe
214− main-is: Prelude/Serial/O_n_Stack.hs
215− build-depends:
216− lib-prelude
180+ main-is: Streamly/Benchmark/Prelude/Serial/O_n_Stack.hs
217181
218182benchmark serial-O-n-space
219183 import: bench-options
220184 type: exitcode-stdio-1.0
221185 ghc-options: -with-rtsopts "-T -K16M -M64M"
222− hs-source-dirs: exe
223− main-is: Prelude/Serial/O_n_Space.hs
224− build-depends:
225− lib-prelude
186+ main-is: Streamly/Benchmark/Prelude/Serial/O_n_Space.hs
226187
227188benchmark nested
228189 import: bench-options
229190 type: exitcode-stdio-1.0
230191 ghc-options: -with-rtsopts "-T -K256K -M16M"
231− hs-source-dirs: .
232192 main-is: Nested.hs
233193 other-modules: NestedOps
234194
235195benchmark nested-unfold
236196 import: bench-options
237197 type: exitcode-stdio-1.0
238− hs-source-dirs: .
239198 ghc-options: -with-rtsopts "-T -K64K -M16M"
240199 main-is: NestedUnfold.hs
241200 other-modules: NestedUnfoldOps
@@ -243,7 +202,6 @@ benchmark nested-unfold
243202benchmark base
244203 import: bench-options
245204 type: exitcode-stdio-1.0
246− hs-source-dirs: .
247205 if flag(dev)
248206 cpp-options: -DDEVBUILD
249207 ghc-options: -with-rtsopts "-T -K2M -M16M"
@@ -256,7 +214,6 @@ benchmark base
256214
257215executable nano-bench
258216 import: bench-options
259− hs-source-dirs: .
260217 main-is: NanoBenchmarks.hs
261218 if flag(dev)
262219 buildable: True
@@ -270,16 +227,12 @@ executable nano-bench
270227benchmark linear-async
271228 import: bench-options-threaded
272229 type: exitcode-stdio-1.0
273− hs-source-dirs: .
274230 ghc-options: -with-rtsopts "-T -N2 -K64K -M16M"
275231 main-is: LinearAsync.hs
276− build-depends:
277− lib-prelude
278232
279233benchmark nested-concurrent
280234 import: bench-options-threaded
281235 type: exitcode-stdio-1.0
282− hs-source-dirs: .
283236 -- XXX this can be lowered once we split out the finite benchmarks
284237 ghc-options: -with-rtsopts "-T -N2 -K256K -M128M"
285238 main-is: NestedConcurrent.hs
@@ -288,39 +241,25 @@ benchmark nested-concurrent
288241benchmark parallel
289242 import: bench-options-threaded
290243 type: exitcode-stdio-1.0
291− hs-source-dirs: .
292244 ghc-options: -with-rtsopts "-T -N2 -K128K -M256M"
293245 main-is: Parallel.hs
294246 other-modules: NestedOps
295− build-depends:
296− lib-prelude
297247
298248benchmark concurrent
299249 import: bench-options-threaded
300250 type: exitcode-stdio-1.0
301− hs-source-dirs: .
302251 main-is: Concurrent.hs
303252 ghc-options: -with-rtsopts "-T -N2 -K256K -M384M"
304253
305254benchmark adaptive
306255 import: bench-options-threaded
307256 type: exitcode-stdio-1.0
308− hs-source-dirs: .
309257 main-is: Adaptive.hs
310− default-language: Haskell2010
311− build-depends:
312− streamly
313− , base >= 4.8 && < 5
314− , gauge >= 0.2.4 && < 0.3
315− , random >= 1.0 && < 2.0
316258
317259benchmark linear-rate
318260 import: bench-options-threaded
319261 type: exitcode-stdio-1.0
320− hs-source-dirs: .
321262 main-is: LinearRate.hs
322− build-depends:
323− lib-prelude
324263
325264-------------------------------------------------------------------------------
326265-- Array Benchmarks
@@ -329,7 +268,6 @@ benchmark linear-rate
329268benchmark unpinned-array
330269 import: bench-options
331270 type: exitcode-stdio-1.0
332− hs-source-dirs: .
333271 ghc-options: -with-rtsopts "-T -K1K -M128M"
334272 main-is: Streamly/Benchmark/Data/Array.hs
335273 other-modules: Streamly.Benchmark.Data.ArrayOps
@@ -337,7 +275,6 @@ benchmark unpinned-array
337275benchmark prim-array
338276 import: bench-options
339277 type: exitcode-stdio-1.0
340− hs-source-dirs: .
341278 ghc-options: -with-rtsopts "-T -K64K -M32M"
342279 main-is: Streamly/Benchmark/Data/Prim/Array.hs
343280 other-modules: Streamly.Benchmark.Data.Prim.ArrayOps
@@ -345,7 +282,6 @@ benchmark prim-array
345282benchmark small-array
346283 import: bench-options
347284 type: exitcode-stdio-1.0
348− hs-source-dirs: .
349285 ghc-options: -with-rtsopts "-T -K128K -M16M"
350286 main-is: Streamly/Benchmark/Data/SmallArray.hs
351287 other-modules: Streamly.Benchmark.Data.SmallArrayOps
@@ -353,7 +289,6 @@ benchmark small-array
353289benchmark array
354290 import: bench-options
355291 type: exitcode-stdio-1.0
356− hs-source-dirs: .
357292 ghc-options: -with-rtsopts "-T -K64K -M128M"
358293 main-is: Array.hs
359294 other-modules: ArrayOps
@@ -365,7 +300,6 @@ benchmark array
365300benchmark fileio
366301 import: bench-options
367302 type: exitcode-stdio-1.0
368− hs-source-dirs: .
369303 main-is: FileIO.hs
370304 other-modules: Streamly.Benchmark.FileIO.Array
371305 , Streamly.Benchmark.FileIO.Stream
@@ -379,7 +313,6 @@ benchmark fileio
379313executable chart
380314 default-language: Haskell2010
381315 ghc-options: -Wall
382− hs-source-dirs: .
383316 main-is: Chart.hs
384317 if flag(dev) && !flag(no-charts) && !impl(ghcjs)
385318 buildable: True
streamly.cabal+2−2
@@ -122,11 +122,11 @@ extra-source-files:
122122 benchmark/streamly-benchmarks.cabal
123123 benchmark/README.md
124124 benchmark/*.hs
125+ benchmark/lib/Streamly/Benchmark/*.hs
125126 benchmark/Streamly/Benchmark/Data/*.hs
126127 benchmark/Streamly/Benchmark/Data/Prim/*.hs
127128 benchmark/Streamly/Benchmark/FileIO/*.hs
128− benchmark/Streamly/Benchmark/*.hs
129− benchmark/exe/Prelude/Serial/*.hs
129+ benchmark/Streamly/Benchmark/Prelude/Serial/*.hs
130130
131131extra-tmp-files:
132132 config.log