on master help sign in
Fix imports, comments and change RTS flags in streamly-benchmarks.cabal
commit425df88c9df4cf72c99e4b99a95a4fe815b7fe4f authorAnurag Hooda <anuraghooda@composewell.com> dateWed 9 Dec 2020, 09:54 (6 years ago) parent91a89db
9 files changed+36−73
benchmark/Streamly/Benchmark/Data/Unfold.hs+17−20 benchmark/Streamly/Benchmark/FileSystem/Handle.hs+2−3 benchmark/Streamly/Benchmark/FileSystem/Handle/Read.hs+2−5 benchmark/Streamly/Benchmark/FileSystem/Handle/ReadWrite.hs+1−3 benchmark/Streamly/Benchmark/Prelude/Serial.hs+4−5 benchmark/Streamly/Benchmark/Prelude/Serial/Exceptions.hs+3−13 benchmark/Streamly/Benchmark/Prelude/Serial/Split.hs+1−1 benchmark/Streamly/Benchmark/Unicode/Stream.hs+1−17 benchmark/streamly-benchmarks.cabal+5−6
benchmark/Streamly/Benchmark/Data/Unfold.hs+17−20
@@ -21,28 +21,29 @@
2121module Main (main) where
2222
2323import Control.DeepSeq (NFData(..))
24−import System.Random (randomRIO)
24+import Control.Exception (SomeException)
25+import System.IO (Handle, hClose)
2526import Streamly.Internal.Data.Unfold (Unfold)
27+import System.Random (randomRIO)
2628
2729import qualified Prelude
30+import qualified Streamly.Benchmark.Data.NestedUnfoldOps as Nested
31+import qualified Streamly.FileSystem.Handle as FH
2832import qualified Streamly.Internal.Data.Fold as FL
2933import qualified Streamly.Internal.Data.Unfold as UF
3034import qualified Streamly.Internal.Data.Stream.IsStream as S
3135import qualified Streamly.Internal.Data.Stream.StreamD as D
3236import qualified Streamly.Internal.Data.Stream.StreamK as K
33−import qualified Streamly.Benchmark.Data.NestedUnfoldOps as Nested
34−
35−-- For Unfold Exception Benchmarks
36−import qualified Streamly.FileSystem.Handle as FH
37−import qualified Streamly.Internal.Data.Unfold as IUF
3837import qualified Streamly.Prelude as SP
39−import Streamly.Benchmark.CommonH
40−import System.IO (Handle, hClose)
41−import Control.Exception (SomeException)
4238
43−import Streamly.Benchmark.Common
4439import Gauge hiding (env)
4540import Prelude hiding (concat, take, filter, zipWith, map, mapM, takeWhile)
41+import Streamly.Benchmark.Common
42+import Streamly.Benchmark.CommonH
43+
44+#ifdef INSPECTION
45+import Test.Inspection
46+#endif
4647
4748{-# INLINE benchIO #-}
4849benchIO :: (NFData b) => String -> (Int -> IO b) -> Benchmark
@@ -428,7 +429,6 @@ _apDiscardFst = undefined
428429_apDiscardSnd :: Int -> Int -> m ()
429430_apDiscardSnd = undefined
430431
431−
432432-------------------------------------------------------------------------------
433433-- Benchmarks
434434-------------------------------------------------------------------------------
@@ -558,7 +558,7 @@ o_n_space_nested size =
558558-- | Send the file contents to /dev/null with exception handling
559559readWriteOnExceptionUnfold :: Handle -> Handle -> IO ()
560560readWriteOnExceptionUnfold inh devNull =
561− let readEx = IUF.onException (\_ -> hClose inh) FH.read
561+ let readEx = UF.onException (\_ -> hClose inh) FH.read
562562 in SP.fold (FH.write devNull) $ SP.unfold readEx inh
563563
564564#ifdef INSPECTION
@@ -570,7 +570,7 @@ inspect $ hasNoTypeClasses 'readWriteOnExceptionUnfold
570570readWriteHandleExceptionUnfold :: Handle -> Handle -> IO ()
571571readWriteHandleExceptionUnfold inh devNull =
572572 let handler (_e :: SomeException) = hClose inh >> return 10
573− readEx = IUF.handle (IUF.singletonM handler) FH.read
573+ readEx = UF.handle (UF.singletonM handler) FH.read
574574 in SP.fold (FH.write devNull) $ SP.unfold readEx inh
575575
576576#ifdef INSPECTION
@@ -581,7 +581,7 @@ inspect $ hasNoTypeClasses 'readWriteHandleExceptionUnfold
581581-- | Send the file contents to /dev/null with exception handling
582582readWriteFinally_Unfold :: Handle -> Handle -> IO ()
583583readWriteFinally_Unfold inh devNull =
584− let readEx = IUF.finally_ (\_ -> hClose inh) FH.read
584+ let readEx = UF.finally_ (\_ -> hClose inh) FH.read
585585 in SP.fold (FH.write devNull) $ SP.unfold readEx inh
586586
587587#ifdef INSPECTION
@@ -591,13 +591,13 @@ inspect $ hasNoTypeClasses 'readWriteFinally_Unfold
591591
592592readWriteFinallyUnfold :: Handle -> Handle -> IO ()
593593readWriteFinallyUnfold inh devNull =
594− let readEx = IUF.finally (\_ -> hClose inh) FH.read
594+ let readEx = UF.finally (\_ -> hClose inh) FH.read
595595 in SP.fold (FH.write devNull) $ SP.unfold readEx inh
596596
597597-- | Send the file contents to /dev/null with exception handling
598598readWriteBracket_Unfold :: Handle -> Handle -> IO ()
599599readWriteBracket_Unfold inh devNull =
600− let readEx = IUF.bracket_ return (\_ -> hClose inh) FH.read
600+ let readEx = UF.bracket_ return (\_ -> hClose inh) FH.read
601601 in SP.fold (FH.write devNull) $ SP.unfold readEx inh
602602
603603#ifdef INSPECTION
@@ -607,7 +607,7 @@ inspect $ hasNoTypeClasses 'readWriteBracket_Unfold
607607
608608readWriteBracketUnfold :: Handle -> Handle -> IO ()
609609readWriteBracketUnfold inh devNull =
610− let readEx = IUF.bracket return (\_ -> hClose inh) FH.read
610+ let readEx = UF.bracket return (\_ -> hClose inh) FH.read
611611 in SP.fold (FH.write devNull) $ S.unfold readEx inh
612612
613613o_1_space_copy_read_exceptions :: BenchEnv -> [Benchmark]
@@ -651,9 +651,6 @@ main = do
651651 , o_1_space_filtering size
652652 , o_1_space_zip size
653653 , o_1_space_nested size
654− -- I have to pass BenchEnv instead of size here
655− -- DONE
656− -- , o_1_space_copy_read_exceptions env
657654 ]
658655 , bgroup (o_n_space_prefix moduleName)
659656 $ Prelude.concat [o_n_space_nested size]
benchmark/Streamly/Benchmark/FileSystem/Handle.hs+2−3
@@ -1,8 +1,7 @@
11-- |
22-- Module : Streamly.Benchmark.FileSystem.Handle
33-- Copyright : (c) 2019 Composewell Technologies
4−--
5−-- License : BSD3
4+-- License : BSD-3-Clause
65-- Maintainer : streamly@composewell.com
76-- Stability : experimental
87-- Portability : GHC
@@ -21,12 +20,12 @@
2120
2221#if __GLASGOW_HASKELL__ >= 800
2322#endif
24−import Prelude hiding (last, length)
2523
2624import qualified Handle.ReadWrite as RW
2725import qualified Handle.Read as RO
2826
2927import Gauge hiding (env)
28+import Prelude hiding (last, length)
3029import Streamly.Benchmark.Common
3130import Streamly.Benchmark.CommonH
3231
benchmark/Streamly/Benchmark/FileSystem/Handle/Read.hs+2−5
@@ -1,8 +1,7 @@
11-- |
22-- Module : Streamly.Benchmark.FileSystem.Handle
33-- Copyright : (c) 2019 Composewell Technologies
4−--
5−-- License : BSD3
4+-- License : BSD-3-Clause
65-- Maintainer : streamly@composewell.com
76-- Stability : experimental
87-- Portability : GHC
@@ -32,12 +31,10 @@ import GHC.Magic (noinline)
3231#define noinline
3332#endif
3433import System.IO (Handle)
35−import Prelude hiding (last, length)
3634
3735import qualified Streamly.Data.Fold as FL
3836import qualified Streamly.Unicode.Stream as SS
3937import qualified Streamly.FileSystem.Handle as FH
40−-- import qualified Streamly.Internal.Data.Fold as IFL
4138import qualified Streamly.Internal.Data.Parser as PR
4239import qualified Streamly.Internal.Data.Stream.StreamD as D
4340import qualified Streamly.Internal.Unicode.Stream as IUS
@@ -49,7 +46,7 @@ import qualified Streamly.Internal.Data.Stream.IsStream as IP
4946import qualified Streamly.Prelude as S
5047
5148import Gauge hiding (env)
52−-- import Handle.Common
49+import Prelude hiding (last, length)
5350import Streamly.Benchmark.CommonH
5451
5552#ifdef INSPECTION
benchmark/Streamly/Benchmark/FileSystem/Handle/ReadWrite.hs+1−3
@@ -1,8 +1,7 @@
11-- |
22-- Module : Streamly.Benchmark.FileSystem.Handle
33-- Copyright : (c) 2019 Composewell Technologies
4−--
5−-- License : BSD3
4+-- License : BSD3-3-Clause
65-- Maintainer : streamly@composewell.com
76-- Stability : experimental
87-- Portability : GHC
@@ -35,7 +34,6 @@ import qualified Streamly.Data.Array.Storable.Foreign as A
3534import qualified Streamly.Prelude as S
3635
3736import Gauge hiding (env)
38−-- import Handle.Common
3937import Streamly.Benchmark.CommonH
4038
4139#ifdef INSPECTION
benchmark/Streamly/Benchmark/Prelude/Serial.hs+4−5
@@ -11,18 +11,17 @@
1111
1212module Main (main) where
1313
14−import qualified Serial.Generation as Generation
1514import qualified Serial.Elimination as Elimination
15+import qualified Serial.Exceptions as Exceptions
16+import qualified Serial.Generation as Generation
17+import qualified Serial.Nested as Nested
18+import qualified Serial.Split as Split
1619import qualified Serial.Transformation1 as Transformation1
1720import qualified Serial.Transformation2 as Transformation2
1821import qualified Serial.Transformation3 as Transformation3
19−import qualified Serial.Nested as Nested
20−import qualified Serial.Exceptions as Exceptions
21−import qualified Serial.Split as Split
2222
2323import Gauge hiding (env)
2424import Streamly.Benchmark.Common
25−
2625import Streamly.Benchmark.CommonH
2726
2827moduleName :: String
benchmark/Streamly/Benchmark/Prelude/Serial/Exceptions.hs+3−13
@@ -1,8 +1,7 @@
11-- |
22-- Module : Streamly.Benchmark.Prelude.Serial.Exceptions
3−-- Copyright : (c) 2020 Composewell Technologies
4−--
5−-- License : BSD3
3+-- Copyright : (c) 2019 Composewell Technologies
4+-- License : BSD-3-Clause
65-- Maintainer : streamly@composewell.com
76-- Stability : experimental
87-- Portability : GHC
@@ -25,7 +24,6 @@ where
2524
2625import Control.Exception (SomeException)
2726import System.IO (Handle, hClose, hPutChar)
28−import Prelude hiding (last, length)
2927
3028import qualified Streamly.FileSystem.Handle as FH
3129import qualified Streamly.Internal.Data.Unfold as IUF
@@ -34,18 +32,10 @@ import qualified Streamly.Internal.Data.Stream.IsStream as IP
3432import qualified Streamly.Prelude as S
3533
3634import Gauge hiding (env)
37−-- import Handle.Common
35+import Prelude hiding (last, length)
3836import Streamly.Benchmark.CommonH
3937
4038#ifdef INSPECTION
41−import Foreign.Storable (Storable)
42−import Streamly.Internal.Data.Stream.StreamD.Type (Step(..))
43−
44−import qualified Streamly.Internal.Data.Stream.StreamD.Type as D
45−import qualified Streamly.Internal.Data.Tuple.Strict as Strict
46−import qualified Streamly.Internal.Data.Array.Storable.Foreign as A
47−import qualified Streamly.Internal.Data.Array.Storable.Foreign.Types as AT
48−
4939import Test.Inspection
5040#endif
5141
benchmark/Streamly/Benchmark/Prelude/Serial/Split.hs+1−1
@@ -26,7 +26,6 @@ where
2626import Data.Char (ord)
2727import Data.Word (Word8)
2828import System.IO (Handle)
29−import Prelude hiding (last, length)
3029
3130import qualified Streamly.Data.Fold as FL
3231import qualified Streamly.FileSystem.Handle as FH
@@ -38,6 +37,7 @@ import qualified Streamly.Internal.Data.Stream.IsStream as IP
3837import qualified Streamly.Prelude as S
3938
4039import Gauge hiding (env)
40+import Prelude hiding (last, length)
4141import Streamly.Benchmark.CommonH
4242
4343#ifdef INSPECTION
benchmark/Streamly/Benchmark/Unicode/Stream.hs+1−17
@@ -190,19 +190,6 @@ o_1_space_copy_read_group_ungroup env =
190190-- copy unfold
191191-------------------------------------------------------------------------------
192192
193−-- -- | Copy file
194−-- copyStream :: Handle -> Handle -> IO ()
195−-- copyStream inh outh = S.fold (FH.write outh) (S.unfold FH.read inh)
196−
197−-- #ifdef INSPECTION
198−-- inspect $ hasNoTypeClasses 'copyStream
199−-- inspect $ 'copyStream `hasNoType` ''Step -- S.unfold
200−-- inspect $ 'copyStream `hasNoType` ''IUF.ConcatState -- FH.read/UF.concat
201−-- inspect $ 'copyStream `hasNoType` ''A.ReadUState -- FH.read/A.read
202−-- inspect $ 'copyStream `hasNoType` ''AT.ArrayUnsafe -- FH.write/writeNUnsafe
203−-- inspect $ 'copyStream `hasNoType` ''Strict.Tuple3' -- FH.write/lchunksOf
204−-- #endif
205−
206193-- | Copy file (encodeLatin1')
207194copyStreamLatin1' :: Handle -> Handle -> IO ()
208195copyStreamLatin1' inh outh =
@@ -270,10 +257,7 @@ inspect $ hasNoTypeClasses 'copyStreamUtf8
270257o_1_space_copy_read :: BenchEnv -> [Benchmark]
271258o_1_space_copy_read env =
272259 [ bgroup "copy/read"
273− [-- mkBench "rawToNull" env $ \inh _ ->
274− -- copyStream inh (nullH env)
275− -- , mkBench "rawToFile" env $ \inh outh ->
276− -- copyStream inh outh
260+ [
277261 -- This needs an ascii file, as decode just errors out.
278262 mkBench "SS.encodeLatin1' . SS.decodeLatin1" env $ \inh outh ->
279263 copyStreamLatin1' inh outh
benchmark/streamly-benchmarks.cabal+5−6
@@ -167,7 +167,8 @@ benchmark Prelude.Serial
167167 , Serial.Nested
168168 , Serial.Exceptions
169169 , Serial.Split
170− ,Streamly.Benchmark.CommonH
170+ , Streamly.Benchmark.CommonH
171+ ghc-options: +RTS -M1000M -RTS
171172 if impl(ghcjs)
172173 buildable: False
173174 else
@@ -176,6 +177,7 @@ benchmark Prelude.Serial
176177 typed-process >= 0.2.3 && < 0.3
177178 , directory >= 1.2.2 && < 1.4
178179 , ghc-prim >= 0.4 && < 0.7
180+ , inspection-testing >= 0.4 && < 0.5
179181
180182benchmark Prelude.WSerial
181183 import: bench-options
@@ -254,8 +256,8 @@ benchmark Data.Unfold
254256 type: exitcode-stdio-1.0
255257 hs-source-dirs: .
256258 main-is: Streamly/Benchmark/Data/Unfold.hs
257− other-modules: Streamly.Benchmark.Data.NestedUnfoldOps
258− ,Streamly.Benchmark.CommonH
259+ other-modules: Streamly.Benchmark.Data.NestedUnfoldOps
260+ , Streamly.Benchmark.CommonH
259261 if impl(ghcjs)
260262 buildable: False
261263 else
@@ -382,7 +384,6 @@ benchmark Prelude.Adaptive
382384 type: exitcode-stdio-1.0
383385 hs-source-dirs: Streamly/Benchmark/Prelude
384386 main-is: Adaptive.hs
385− ghc-options: +RTS -M3000M -RTS
386387 if impl(ghcjs)
387388 buildable: False
388389 else
@@ -456,7 +457,6 @@ benchmark FileSystem.Handle
456457 other-modules:
457458 Handle.Read
458459 , Handle.ReadWrite
459− -- , Handle.Common
460460 , Streamly.Benchmark.CommonH
461461 build-depends:
462462 typed-process >= 0.2.3 && < 0.3
@@ -469,7 +469,6 @@ benchmark FileSystem.Handle
469469benchmark Unicode.Stream
470470 import: bench-options
471471 type: exitcode-stdio-1.0
472− ghc-options: +RTS -M3000M -RTS
473472 hs-source-dirs: . Streamly/Benchmark/Unicode
474473 main-is: Stream.hs
475474 other-modules: