Skip to content

Commit

Permalink
Update the benchmark tooling
Browse files Browse the repository at this point in the history
  • Loading branch information
adithyaov committed Oct 4, 2024
1 parent 24dca08 commit 5578163
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 13 deletions.
26 changes: 14 additions & 12 deletions benchmark/Streamly/Benchmark/Data/StreamK.hs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import Control.Monad (when)
import Data.Maybe (isJust)
import Streamly.Internal.Data.StreamK (StreamK)
import System.Random (randomRIO)
import Test.Tasty.Bench (bench, nfIO, bgroup, Benchmark, defaultMain)
import Test.Tasty.Bench (bench, nfIO, bgroup, Benchmark)

import qualified Data.List as List
import qualified Prelude as P
Expand Down Expand Up @@ -669,7 +669,6 @@ o_1_space_concat streamLen =
(concatMapBySerial streamLen2 streamLen2)
, benchIOSrc1 "concatMapBy serial (1 of n)"
(concatMapBySerial 1 streamLen)
, benchFold "sortBy" sortBy (unfoldrM streamLen)
]
where
streamLen2 = round (P.fromIntegral streamLen**(1/2::P.Double)) -- double nested loop
Expand Down Expand Up @@ -797,6 +796,9 @@ o_n_heap streamLen =
[ bgroup "transformation"
[ benchFold "foldlS" (foldlS 1) (unfoldrM streamLen)
]
, bgroup "concat"
[ benchFold "sortBy" sortBy (unfoldrM streamLen)
]
]

{-# INLINE benchK #-}
Expand Down Expand Up @@ -849,16 +851,16 @@ benchList :: P.String -> ([Int] -> [Int]) -> (Int -> [Int]) -> Benchmark
benchList name run f = bench name $ nfIO $ randomRIO (1,1) >>= return . run . f

main :: IO ()
main =
defaultMain
[ o_1_space streamLen
, o_n_stack streamLen iterStreamLen maxIters
, o_n_heap streamLen
, o_n_space streamLen
]
main = do
runWithCLIOpts defaultStreamSize allBenchmarks

where

streamLen = 100000
maxIters = 10000
iterStreamLen = 10
allBenchmarks streamLen =
let !iterStreamLen = 10
!maxIters = streamLen `div` iterStreamLen
in [ o_1_space streamLen
, o_n_stack streamLen iterStreamLen maxIters
, o_n_heap streamLen
, o_n_space streamLen
]
6 changes: 6 additions & 0 deletions benchmark/bench-runner/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,12 @@ rtsOpts exeName benchName0 = unwords [general, exeSpecific, benchSpecific]
-- this, so the reason may be related to chunked streams.
| "Data.ParserK/o-1-space"
`isPrefixOf` benchName = "-K4M -M256M"
{-
-- XXX This options does not seem to take effect. "ParserK.Chunked"
-- needs more memory to work with --long option
| "Data.ParserK.Chunked.Generic/o-1-space"
`isPrefixOf` benchName = "-K4M -M256M"
-}

-----------------------------------------------------------------------

Expand Down
2 changes: 1 addition & 1 deletion benchmark/streamly-benchmarks.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ benchmark Data.Parser
if flag(dev)
ghc-options: +RTS -M3000M -RTS
else
ghc-options: +RTS -M2000M -RTS
ghc-options: +RTS -M2500M -RTS

-- XXX This is chunked?
benchmark Data.ParserK
Expand Down

0 comments on commit 5578163

Please sign in to comment.