on master help sign in
Move passing benchmark properties to the root in bench:StreamK
ada707bAdithya Kumar
benchmark/Streamly/Benchmark/Data/Stream/StreamK.hs+21−22
@@ -715,8 +715,8 @@ o_1_space_list value =
715 value2 = round (P.fromIntegral value**(1/2::P.Double)) -- double nested loop
715 value2 = round (P.fromIntegral value**(1/2::P.Double)) -- double nested loop
716 value3 = round (P.fromIntegral value**(1/3::P.Double)) -- triple nested loop
716 value3 = round (P.fromIntegral value**(1/3::P.Double)) -- triple nested loop
717
717
718−o_1_space :: Benchmark
718+o_1_space :: Int -> Benchmark
719−o_1_space =
719+o_1_space value =
720 bgroup (o_1_space_prefix moduleName)
720 bgroup (o_1_space_prefix moduleName)
721 [ o_1_space_generation value
721 [ o_1_space_generation value
722 , o_1_space_elimination value
722 , o_1_space_elimination value
@@ -728,26 +728,21 @@ o_1_space =
728 , o_1_space_mixed value
728 , o_1_space_mixed value
729 , o_1_space_list value
729 , o_1_space_list value
730 ]
730 ]
731− where
732− value = 100000
733
731
734−o_n_heap :: Benchmark
732+o_n_heap :: Int -> Benchmark
735−o_n_heap =
733+o_n_heap value =
736 bgroup (o_n_heap_prefix moduleName)
734 bgroup (o_n_heap_prefix moduleName)
737 [ bgroup "transformation"
735 [ bgroup "transformation"
738 [ benchFold "foldlS" (foldlS 1) (sourceUnfoldrM value)
736 [ benchFold "foldlS" (foldlS 1) (sourceUnfoldrM value)
739 ]
737 ]
740 ]
738 ]
741− where
742−
743− value = 100000
744
739
745{-# INLINE benchK #-}
740{-# INLINE benchK #-}
746benchK :: P.String -> (Int -> Stream P.IO Int) -> Benchmark
741benchK :: P.String -> (Int -> Stream P.IO Int) -> Benchmark
747benchK name f = bench name $ nfIO $ randomRIO (1,1) >>= toNull . f
742benchK name f = bench name $ nfIO $ randomRIO (1,1) >>= toNull . f
748
743
749−o_n_stack :: Benchmark
744+o_n_stack :: Int -> Int -> Int -> Benchmark
750−o_n_stack =
745+o_n_stack value iterStreamLen maxIters =
751 bgroup (o_n_stack_prefix moduleName)
746 bgroup (o_n_stack_prefix moduleName)
752 [ bgroup "elimination"
747 [ bgroup "elimination"
753 [ benchFold "tail" tail (sourceUnfoldrM value)
748 [ benchFold "tail" tail (sourceUnfoldrM value)
@@ -775,29 +770,33 @@ o_n_stack =
775 ]
770 ]
776 ]
771 ]
777 where
772 where
778−
779− value = 100000
780 value2 = round (P.fromIntegral value**(1/2::P.Double)) -- double nested loop
773 value2 = round (P.fromIntegral value**(1/2::P.Double)) -- double nested loop
781 value16 = round (P.fromIntegral value**(1/16::P.Double)) -- triple nested loop
774 value16 = round (P.fromIntegral value**(1/16::P.Double)) -- triple nested loop
782 maxValue = value
775 maxValue = value
783− maxIters = 10000
784− iterStreamLen = 10
785
776
786−o_n_space :: Benchmark
777+o_n_space :: Int -> Benchmark
787−o_n_space =
778+o_n_space value =
788 bgroup (o_n_space_prefix moduleName)
779 bgroup (o_n_space_prefix moduleName)
789 [ bgroup "elimination"
780 [ bgroup "elimination"
790 [ benchFold "toList" toList (sourceUnfoldrM value)
781 [ benchFold "toList" toList (sourceUnfoldrM value)
791 ]
782 ]
792 ]
783 ]
793− where
794−
795− value = 100000
796−
797
784
798{-# INLINE benchList #-}
785{-# INLINE benchList #-}
799benchList :: P.String -> ([Int] -> [Int]) -> (Int -> [Int]) -> Benchmark
786benchList :: P.String -> ([Int] -> [Int]) -> (Int -> [Int]) -> Benchmark
800benchList name run f = bench name $ nfIO $ randomRIO (1,1) >>= return . run . f
787benchList name run f = bench name $ nfIO $ randomRIO (1,1) >>= return . run . f
801
788
802main :: IO ()
789main :: 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