3#include "Streamly/Benchmark/Data/Array/CommonImports.hs"
5import qualified Streamly.Internal.Data.Array.Prim as A
8#include "Streamly/Benchmark/Data/Array/Common.hs"
10-------------------------------------------------------------------------------
12-------------------------------------------------------------------------------
14-- Drain a source that generates an array in the IO monad
15{-# INLINE benchIOSrc #-}
16benchIOSrc :: String -> (Int -> IO (Stream a)) -> Benchmark
17benchIOSrc name src = benchIO name src id
19-------------------------------------------------------------------------------
21-------------------------------------------------------------------------------
23{-# INLINE sourceIntFromToFromList #-}
24sourceIntFromToFromList :: MonadIO m => Int -> Int -> m (Stream Int)
25sourceIntFromToFromList value n = P.return $ A.fromListN value [n..n + value]
28{-# INLINE sourceIntFromToFromStream #-}
29sourceIntFromToFromStream :: MonadIO m => Int -> Int -> m (Stream Int)
30sourceIntFromToFromStream value n = S.fold A.write $ S.enumerateFromTo n (n + value)
32-------------------------------------------------------------------------------
34-------------------------------------------------------------------------------
36o_1_space_generation :: Int -> [Benchmark]
37o_1_space_generation value =
40 [ benchIOSrc "write . intFromTo" (sourceIntFromToFromStream value)
45moduleName = "Data.Array.Prim"
48defStreamSize = defaultStreamSize
51main = runWithCLIOpts defStreamSize allBenchmarks
56 bgroup (o_1_space_prefix moduleName) (o_1_space_generation size)
57 : commonBenchmarks size
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list