on master help sign in
Move passing benchmark properties to the root in bench:StreamK
commitada707b778bc978f6d085eb0e1310c5683130819 authorAdithya Kumar <adithya@composewell.com> dateMon 29 Mar 2021, 10:14 (6 years ago) parentad4bcce
1 file changed+21−22
benchmark/Streamly/Benchmark/Data/Stream/StreamK.hs+21−22
benchmark/Streamly/Benchmark/Data/Stream/StreamK.hs+21−22
@@ -715,8 +715,8 @@ o_1_space_list value =
715715 value2 = round (P.fromIntegral value**(1/2::P.Double)) -- double nested loop
716716 value3 = round (P.fromIntegral value**(1/3::P.Double)) -- triple nested loop
717717
718−o_1_space :: Benchmark
719−o_1_space =
718+o_1_space :: Int -> Benchmark
719+o_1_space value =
720720 bgroup (o_1_space_prefix moduleName)
721721 [ o_1_space_generation value
722722 , o_1_space_elimination value
@@ -728,26 +728,21 @@ o_1_space =
728728 , o_1_space_mixed value
729729 , o_1_space_list value
730730 ]
731− where
732− value = 100000
733731
734−o_n_heap :: Benchmark
735−o_n_heap =
732+o_n_heap :: Int -> Benchmark
733+o_n_heap value =
736734 bgroup (o_n_heap_prefix moduleName)
737735 [ bgroup "transformation"
738736 [ benchFold "foldlS" (foldlS 1) (sourceUnfoldrM value)
739737 ]
740738 ]
741− where
742−
743− value = 100000
744739
745740{-# INLINE benchK #-}
746741benchK :: P.String -> (Int -> Stream P.IO Int) -> Benchmark
747742benchK name f = bench name $ nfIO $ randomRIO (1,1) >>= toNull . f
748743
749−o_n_stack :: Benchmark
750−o_n_stack =
744+o_n_stack :: Int -> Int -> Int -> Benchmark
745+o_n_stack value iterStreamLen maxIters =
751746 bgroup (o_n_stack_prefix moduleName)
752747 [ bgroup "elimination"
753748 [ benchFold "tail" tail (sourceUnfoldrM value)
@@ -775,29 +770,33 @@ o_n_stack =
775770 ]
776771 ]
777772 where
778−
779− value = 100000
780773 value2 = round (P.fromIntegral value**(1/2::P.Double)) -- double nested loop
781774 value16 = round (P.fromIntegral value**(1/16::P.Double)) -- triple nested loop
782775 maxValue = value
783− maxIters = 10000
784− iterStreamLen = 10
785776
786−o_n_space :: Benchmark
787−o_n_space =
777+o_n_space :: Int -> Benchmark
778+o_n_space value =
788779 bgroup (o_n_space_prefix moduleName)
789780 [ bgroup "elimination"
790781 [ benchFold "toList" toList (sourceUnfoldrM value)
791782 ]
792783 ]
793− where
794−
795− value = 100000
796−
797784
798785{-# INLINE benchList #-}
799786benchList :: P.String -> ([Int] -> [Int]) -> (Int -> [Int]) -> Benchmark
800787benchList name run f = bench name $ nfIO $ randomRIO (1,1) >>= return . run . f
801788
802789main :: IO ()
803−main = defaultMain [o_1_space, o_n_stack, o_n_heap, o_n_space]
790+main =
791+ defaultMain
792+ [ o_1_space value
793+ , o_n_stack value iterStreamLen maxIters
794+ , o_n_heap value
795+ , o_n_space value
796+ ]
797+
798+ where
799+
800+ value = 100000
801+ maxIters = 10000
802+ iterStreamLen = 10