@@ -27,10 +27,7 @@ module Streamly.Benchmark.Prelude
27 , o_1_space_serial_foldable
27 , o_1_space_serial_foldable
28 , o_1_space_serial_generation
28 , o_1_space_serial_generation
29 , o_1_space_serial_elimination
29 , o_1_space_serial_elimination
30− , o_1_space_serial_folds
31 , o_1_space_serial_foldMultiStream
30 , o_1_space_serial_foldMultiStream
32− , o_1_space_serial_foldsTransforms
33− , o_1_space_serial_foldsCompositions
34 , o_1_space_serial_pipes
31 , o_1_space_serial_pipes
35 , o_1_space_serial_pipesX4
32 , o_1_space_serial_pipesX4
36 , o_1_space_serial_transformer
33 , o_1_space_serial_transformer
@@ -102,7 +99,6 @@ import Control.Monad.IO.Class (MonadIO(..))
102import Control.Monad.State.Strict (StateT, get, put)
99import Control.Monad.State.Strict (StateT, get, put)
103import Data.Functor.Identity (Identity, runIdentity)
100import Data.Functor.Identity (Identity, runIdentity)
104import Data.IORef (newIORef, modifyIORef')
101import Data.IORef (newIORef, modifyIORef')
105−import Data.Monoid (Last(..))
106import GHC.Generics (Generic)
102import GHC.Generics (Generic)
107import System.Random (randomRIO)
103import System.Random (randomRIO)
108import Prelude
104import Prelude
@@ -130,11 +126,6 @@ import qualified Streamly.Internal.Data.Pipe as Pipe
130import qualified Streamly.Internal.Data.Stream.Parallel as Par
126import qualified Streamly.Internal.Data.Stream.Parallel as Par
131import Streamly.Internal.Data.Time.Units
127import Streamly.Internal.Data.Time.Units
133−import qualified Streamly.Internal.Data.Sink as Sink
135−import qualified Streamly.Memory.Array as A
136−import qualified Streamly.Internal.Memory.Array as IA
137−import qualified Streamly.Internal.Data.Fold as IFL
138import qualified Streamly.Internal.Prelude as IP
129import qualified Streamly.Internal.Prelude as IP
140import qualified NestedOps as Nested
131import qualified NestedOps as Nested
@@ -1760,90 +1751,6 @@ o_1_space_serial_elimination value =
1763−o_1_space_serial_folds :: Int -> [Benchmark]
1764−o_1_space_serial_folds value =
1769− [ benchIOSink value "drain" (S.fold FL.drain)
1770− , benchIOSink value "drainN" (S.fold (IFL.drainN value))
1774− (S.fold (IFL.drainWhile $ (<=) (value + 1)))
1778− (S.fold (IFL.drainWhile $ (>=) (value + 1)))
1779− , benchIOSink value "sink" (S.fold $ Sink.toFold Sink.drain)
1780− , benchIOSink value "last" (S.fold FL.last)
1781− , benchIOSink value "lastN.1" (S.fold (IA.lastN 1))
1782− , benchIOSink value "lastN.10" (S.fold (IA.lastN 10))
1783− , benchIOSink value "length" (S.fold FL.length)
1784− , benchIOSink value "sum" (S.fold FL.sum)
1785− , benchIOSink value "product" (S.fold FL.product)
1786− , benchIOSink value "maximumBy" (S.fold (FL.maximumBy compare))
1787− , benchIOSink value "maximum" (S.fold FL.maximum)
1788− , benchIOSink value "minimumBy" (S.fold (FL.minimumBy compare))
1789− , benchIOSink value "minimum" (S.fold FL.minimum)
1796− (S.map (fromIntegral :: Int -> Double) s))
1803− (S.map (fromIntegral :: Int -> Double) s))
1810− (S.map (fromIntegral :: Int -> Double) s))
1814− (S.fold FL.mconcat . (S.map (Last . Just)))
1818− (S.fold (FL.foldMap (Last . Just)))
1819− , benchIOSink value "index" (S.fold (FL.index (value + 1)))
1820− , benchIOSink value "head" (S.fold FL.head)
1821− , benchIOSink value "find" (S.fold (FL.find (== (value + 1))))
1825− (S.fold (FL.findIndex (== (value + 1))))
1829− (S.fold (FL.elemIndex (value + 1)))
1830− , benchIOSink value "null" (S.fold FL.null)
1831− , benchIOSink value "elem" (S.fold (FL.elem (value + 1)))
1832− , benchIOSink value "notElem" (S.fold (FL.notElem (value + 1)))
1833− , benchIOSink value "all" (S.fold (FL.all (<= (value + 1))))
1834− , benchIOSink value "any" (S.fold (FL.any (> (value + 1))))
1838− (\s -> S.fold FL.and (S.map (<= (value + 1)) s))
1842− (\s -> S.fold FL.or (S.map (> (value + 1)) s))
1847o_1_space_serial_foldMultiStream :: Int -> [Benchmark]
1754o_1_space_serial_foldMultiStream :: Int -> [Benchmark]
1848o_1_space_serial_foldMultiStream value =
1755o_1_space_serial_foldMultiStream value =
1849 [ bgroup
1756 [ bgroup
@@ -1859,45 +1766,6 @@ o_1_space_serial_foldMultiStream value =
1862−o_1_space_serial_foldsTransforms :: Int -> [Benchmark]
1863−o_1_space_serial_foldsTransforms value =
1868− [ benchIOSink value "drain" (S.fold FL.drain)
1869− , benchIOSink value "lmap" (S.fold (IFL.lmap (+ 1) FL.drain))
1875− (Pipe.mapM (\x -> return $ x + 1))
1881−o_1_space_serial_foldsCompositions :: Int -> [Benchmark]
1882−o_1_space_serial_foldsCompositions value =
1886− "folds-compositions" -- Applicative
1891− ((,) <$> FL.all (<= (value + 1)) <*>
1892− FL.any (> (value + 1))))
1896− (S.fold ((,) <$> FL.sum <*> FL.length))
1901o_1_space_serial_pipes :: Int -> [Benchmark]
1769o_1_space_serial_pipes :: Int -> [Benchmark]
1902o_1_space_serial_pipes value =
1770o_1_space_serial_pipes value =
1903 [ bgroup
1771 [ bgroup
@@ -2389,13 +2257,6 @@ o_n_heap_serial_foldl value =
2390 "foldlM'/build/Identity"
2258 "foldlM'/build/Identity"
2391 foldlM'Build
2259 foldlM'Build
2392− , benchIOSink value "toStream" (S.fold IP.toStream)
2393− , benchIOSink value "toStreamRev" (S.fold IP.toStreamRev)
2394− , benchIOSink value "toList" (S.fold FL.toList)
2395− , benchIOSink value "toListRevF" (S.fold IFL.toListRevF)
2396− -- Converting the stream to an array
2397− , benchIOSink value "lastN.Max" (S.fold (IA.lastN (value + 1)))
2398− , benchIOSink value "writeN" (S.fold (A.writeN value))
2399 -- Reversing/sorting a stream
2260 -- Reversing/sorting a stream
2400 , benchIOSink value "reverse" (reverse 1)
2261 , benchIOSink value "reverse" (reverse 1)
2401 , benchIOSink value "reverse'" (reverse' 1)
2262 , benchIOSink value "reverse'" (reverse' 1)