Fix imports, comments and change RTS flags in streamly-benchmarks.cabal

This commit is contained in:
Anurag Hooda 2020-12-09 09:54:32 +00:00 committed by Harendra Kumar
parent 91a89db002
commit 425df88c9d
9 changed files with 36 additions and 73 deletions

View File

@ -21,28 +21,29 @@
module Main (main) where
import Control.DeepSeq (NFData(..))
import System.Random (randomRIO)
import Control.Exception (SomeException)
import System.IO (Handle, hClose)
import Streamly.Internal.Data.Unfold (Unfold)
import System.Random (randomRIO)
import qualified Prelude
import qualified Streamly.Benchmark.Data.NestedUnfoldOps as Nested
import qualified Streamly.FileSystem.Handle as FH
import qualified Streamly.Internal.Data.Fold as FL
import qualified Streamly.Internal.Data.Unfold as UF
import qualified Streamly.Internal.Data.Stream.IsStream as S
import qualified Streamly.Internal.Data.Stream.StreamD as D
import qualified Streamly.Internal.Data.Stream.StreamK as K
import qualified Streamly.Benchmark.Data.NestedUnfoldOps as Nested
-- For Unfold Exception Benchmarks
import qualified Streamly.FileSystem.Handle as FH
import qualified Streamly.Internal.Data.Unfold as IUF
import qualified Streamly.Prelude as SP
import Streamly.Benchmark.CommonH
import System.IO (Handle, hClose)
import Control.Exception (SomeException)
import Streamly.Benchmark.Common
import Gauge hiding (env)
import Prelude hiding (concat, take, filter, zipWith, map, mapM, takeWhile)
import Streamly.Benchmark.Common
import Streamly.Benchmark.CommonH
#ifdef INSPECTION
import Test.Inspection
#endif
{-# INLINE benchIO #-}
benchIO :: (NFData b) => String -> (Int -> IO b) -> Benchmark
@ -428,7 +429,6 @@ _apDiscardFst = undefined
_apDiscardSnd :: Int -> Int -> m ()
_apDiscardSnd = undefined
-------------------------------------------------------------------------------
-- Benchmarks
-------------------------------------------------------------------------------
@ -558,7 +558,7 @@ o_n_space_nested size =
-- | Send the file contents to /dev/null with exception handling
readWriteOnExceptionUnfold :: Handle -> Handle -> IO ()
readWriteOnExceptionUnfold inh devNull =
let readEx = IUF.onException (\_ -> hClose inh) FH.read
let readEx = UF.onException (\_ -> hClose inh) FH.read
in SP.fold (FH.write devNull) $ SP.unfold readEx inh
#ifdef INSPECTION
@ -570,7 +570,7 @@ inspect $ hasNoTypeClasses 'readWriteOnExceptionUnfold
readWriteHandleExceptionUnfold :: Handle -> Handle -> IO ()
readWriteHandleExceptionUnfold inh devNull =
let handler (_e :: SomeException) = hClose inh >> return 10
readEx = IUF.handle (IUF.singletonM handler) FH.read
readEx = UF.handle (UF.singletonM handler) FH.read
in SP.fold (FH.write devNull) $ SP.unfold readEx inh
#ifdef INSPECTION
@ -581,7 +581,7 @@ inspect $ hasNoTypeClasses 'readWriteHandleExceptionUnfold
-- | Send the file contents to /dev/null with exception handling
readWriteFinally_Unfold :: Handle -> Handle -> IO ()
readWriteFinally_Unfold inh devNull =
let readEx = IUF.finally_ (\_ -> hClose inh) FH.read
let readEx = UF.finally_ (\_ -> hClose inh) FH.read
in SP.fold (FH.write devNull) $ SP.unfold readEx inh
#ifdef INSPECTION
@ -591,13 +591,13 @@ inspect $ hasNoTypeClasses 'readWriteFinally_Unfold
readWriteFinallyUnfold :: Handle -> Handle -> IO ()
readWriteFinallyUnfold inh devNull =
let readEx = IUF.finally (\_ -> hClose inh) FH.read
let readEx = UF.finally (\_ -> hClose inh) FH.read
in SP.fold (FH.write devNull) $ SP.unfold readEx inh
-- | Send the file contents to /dev/null with exception handling
readWriteBracket_Unfold :: Handle -> Handle -> IO ()
readWriteBracket_Unfold inh devNull =
let readEx = IUF.bracket_ return (\_ -> hClose inh) FH.read
let readEx = UF.bracket_ return (\_ -> hClose inh) FH.read
in SP.fold (FH.write devNull) $ SP.unfold readEx inh
#ifdef INSPECTION
@ -607,7 +607,7 @@ inspect $ hasNoTypeClasses 'readWriteBracket_Unfold
readWriteBracketUnfold :: Handle -> Handle -> IO ()
readWriteBracketUnfold inh devNull =
let readEx = IUF.bracket return (\_ -> hClose inh) FH.read
let readEx = UF.bracket return (\_ -> hClose inh) FH.read
in SP.fold (FH.write devNull) $ S.unfold readEx inh
o_1_space_copy_read_exceptions :: BenchEnv -> [Benchmark]
@ -651,9 +651,6 @@ main = do
, o_1_space_filtering size
, o_1_space_zip size
, o_1_space_nested size
-- I have to pass BenchEnv instead of size here
-- DONE
-- , o_1_space_copy_read_exceptions env
]
, bgroup (o_n_space_prefix moduleName)
$ Prelude.concat [o_n_space_nested size]

View File

@ -1,8 +1,7 @@
-- |
-- Module : Streamly.Benchmark.FileSystem.Handle
-- Copyright : (c) 2019 Composewell Technologies
--
-- License : BSD3
-- License : BSD-3-Clause
-- Maintainer : streamly@composewell.com
-- Stability : experimental
-- Portability : GHC
@ -21,12 +20,12 @@
#if __GLASGOW_HASKELL__ >= 800
#endif
import Prelude hiding (last, length)
import qualified Handle.ReadWrite as RW
import qualified Handle.Read as RO
import Gauge hiding (env)
import Prelude hiding (last, length)
import Streamly.Benchmark.Common
import Streamly.Benchmark.CommonH

View File

@ -1,8 +1,7 @@
-- |
-- Module : Streamly.Benchmark.FileSystem.Handle
-- Copyright : (c) 2019 Composewell Technologies
--
-- License : BSD3
-- License : BSD-3-Clause
-- Maintainer : streamly@composewell.com
-- Stability : experimental
-- Portability : GHC
@ -32,12 +31,10 @@ import GHC.Magic (noinline)
#define noinline
#endif
import System.IO (Handle)
import Prelude hiding (last, length)
import qualified Streamly.Data.Fold as FL
import qualified Streamly.Unicode.Stream as SS
import qualified Streamly.FileSystem.Handle as FH
-- import qualified Streamly.Internal.Data.Fold as IFL
import qualified Streamly.Internal.Data.Parser as PR
import qualified Streamly.Internal.Data.Stream.StreamD as D
import qualified Streamly.Internal.Unicode.Stream as IUS
@ -49,7 +46,7 @@ import qualified Streamly.Internal.Data.Stream.IsStream as IP
import qualified Streamly.Prelude as S
import Gauge hiding (env)
-- import Handle.Common
import Prelude hiding (last, length)
import Streamly.Benchmark.CommonH
#ifdef INSPECTION

View File

@ -1,8 +1,7 @@
-- |
-- Module : Streamly.Benchmark.FileSystem.Handle
-- Copyright : (c) 2019 Composewell Technologies
--
-- License : BSD3
-- License : BSD3-3-Clause
-- Maintainer : streamly@composewell.com
-- Stability : experimental
-- Portability : GHC
@ -35,7 +34,6 @@ import qualified Streamly.Data.Array.Storable.Foreign as A
import qualified Streamly.Prelude as S
import Gauge hiding (env)
-- import Handle.Common
import Streamly.Benchmark.CommonH
#ifdef INSPECTION

View File

@ -11,18 +11,17 @@
module Main (main) where
import qualified Serial.Generation as Generation
import qualified Serial.Elimination as Elimination
import qualified Serial.Exceptions as Exceptions
import qualified Serial.Generation as Generation
import qualified Serial.Nested as Nested
import qualified Serial.Split as Split
import qualified Serial.Transformation1 as Transformation1
import qualified Serial.Transformation2 as Transformation2
import qualified Serial.Transformation3 as Transformation3
import qualified Serial.Nested as Nested
import qualified Serial.Exceptions as Exceptions
import qualified Serial.Split as Split
import Gauge hiding (env)
import Streamly.Benchmark.Common
import Streamly.Benchmark.CommonH
moduleName :: String

View File

@ -1,8 +1,7 @@
-- |
-- Module : Streamly.Benchmark.Prelude.Serial.Exceptions
-- Copyright : (c) 2020 Composewell Technologies
--
-- License : BSD3
-- Copyright : (c) 2019 Composewell Technologies
-- License : BSD-3-Clause
-- Maintainer : streamly@composewell.com
-- Stability : experimental
-- Portability : GHC
@ -25,7 +24,6 @@ where
import Control.Exception (SomeException)
import System.IO (Handle, hClose, hPutChar)
import Prelude hiding (last, length)
import qualified Streamly.FileSystem.Handle as FH
import qualified Streamly.Internal.Data.Unfold as IUF
@ -34,18 +32,10 @@ import qualified Streamly.Internal.Data.Stream.IsStream as IP
import qualified Streamly.Prelude as S
import Gauge hiding (env)
-- import Handle.Common
import Prelude hiding (last, length)
import Streamly.Benchmark.CommonH
#ifdef INSPECTION
import Foreign.Storable (Storable)
import Streamly.Internal.Data.Stream.StreamD.Type (Step(..))
import qualified Streamly.Internal.Data.Stream.StreamD.Type as D
import qualified Streamly.Internal.Data.Tuple.Strict as Strict
import qualified Streamly.Internal.Data.Array.Storable.Foreign as A
import qualified Streamly.Internal.Data.Array.Storable.Foreign.Types as AT
import Test.Inspection
#endif

View File

@ -26,7 +26,6 @@ where
import Data.Char (ord)
import Data.Word (Word8)
import System.IO (Handle)
import Prelude hiding (last, length)
import qualified Streamly.Data.Fold as FL
import qualified Streamly.FileSystem.Handle as FH
@ -38,6 +37,7 @@ import qualified Streamly.Internal.Data.Stream.IsStream as IP
import qualified Streamly.Prelude as S
import Gauge hiding (env)
import Prelude hiding (last, length)
import Streamly.Benchmark.CommonH
#ifdef INSPECTION

View File

@ -190,19 +190,6 @@ o_1_space_copy_read_group_ungroup env =
-- copy unfold
-------------------------------------------------------------------------------
-- -- | Copy file
-- copyStream :: Handle -> Handle -> IO ()
-- copyStream inh outh = S.fold (FH.write outh) (S.unfold FH.read inh)
-- #ifdef INSPECTION
-- inspect $ hasNoTypeClasses 'copyStream
-- inspect $ 'copyStream `hasNoType` ''Step -- S.unfold
-- inspect $ 'copyStream `hasNoType` ''IUF.ConcatState -- FH.read/UF.concat
-- inspect $ 'copyStream `hasNoType` ''A.ReadUState -- FH.read/A.read
-- inspect $ 'copyStream `hasNoType` ''AT.ArrayUnsafe -- FH.write/writeNUnsafe
-- inspect $ 'copyStream `hasNoType` ''Strict.Tuple3' -- FH.write/lchunksOf
-- #endif
-- | Copy file (encodeLatin1')
copyStreamLatin1' :: Handle -> Handle -> IO ()
copyStreamLatin1' inh outh =
@ -270,10 +257,7 @@ inspect $ hasNoTypeClasses 'copyStreamUtf8
o_1_space_copy_read :: BenchEnv -> [Benchmark]
o_1_space_copy_read env =
[ bgroup "copy/read"
[-- mkBench "rawToNull" env $ \inh _ ->
-- copyStream inh (nullH env)
-- , mkBench "rawToFile" env $ \inh outh ->
-- copyStream inh outh
[
-- This needs an ascii file, as decode just errors out.
mkBench "SS.encodeLatin1' . SS.decodeLatin1" env $ \inh outh ->
copyStreamLatin1' inh outh

View File

@ -167,7 +167,8 @@ benchmark Prelude.Serial
, Serial.Nested
, Serial.Exceptions
, Serial.Split
,Streamly.Benchmark.CommonH
, Streamly.Benchmark.CommonH
ghc-options: +RTS -M1000M -RTS
if impl(ghcjs)
buildable: False
else
@ -176,6 +177,7 @@ benchmark Prelude.Serial
typed-process >= 0.2.3 && < 0.3
, directory >= 1.2.2 && < 1.4
, ghc-prim >= 0.4 && < 0.7
, inspection-testing >= 0.4 && < 0.5
benchmark Prelude.WSerial
import: bench-options
@ -254,8 +256,8 @@ benchmark Data.Unfold
type: exitcode-stdio-1.0
hs-source-dirs: .
main-is: Streamly/Benchmark/Data/Unfold.hs
other-modules: Streamly.Benchmark.Data.NestedUnfoldOps
,Streamly.Benchmark.CommonH
other-modules: Streamly.Benchmark.Data.NestedUnfoldOps
, Streamly.Benchmark.CommonH
if impl(ghcjs)
buildable: False
else
@ -382,7 +384,6 @@ benchmark Prelude.Adaptive
type: exitcode-stdio-1.0
hs-source-dirs: Streamly/Benchmark/Prelude
main-is: Adaptive.hs
ghc-options: +RTS -M3000M -RTS
if impl(ghcjs)
buildable: False
else
@ -456,7 +457,6 @@ benchmark FileSystem.Handle
other-modules:
Handle.Read
, Handle.ReadWrite
-- , Handle.Common
, Streamly.Benchmark.CommonH
build-depends:
typed-process >= 0.2.3 && < 0.3
@ -469,7 +469,6 @@ benchmark FileSystem.Handle
benchmark Unicode.Stream
import: bench-options
type: exitcode-stdio-1.0
ghc-options: +RTS -M3000M -RTS
hs-source-dirs: . Streamly/Benchmark/Unicode
main-is: Stream.hs
other-modules: