on master help sign in
Add NOINLINE for better optimization of loops
cd0a185Harendra Kumar
benchmark/Streamly/Benchmark/Unicode/Stream.hs+15
@@ -39,6 +39,7 @@ import Streamly.Benchmark.Common.Handle
39#ifdef INSPECTION
39#ifdef INSPECTION
40import Foreign.Storable (Storable)
40import Foreign.Storable (Storable)
41import Streamly.Internal.Data.Stream.StreamD.Type (Step(..))
41import Streamly.Internal.Data.Stream.StreamD.Type (Step(..))
42+import qualified Streamly.Internal.Data.Fold.Types as Fold
42import qualified Streamly.Internal.Data.Tuple.Strict as Strict
43import qualified Streamly.Internal.Data.Tuple.Strict as Strict
43import qualified Streamly.Internal.Data.Array.Foreign.Type as AT
44import qualified Streamly.Internal.Data.Array.Foreign.Type as AT
44import qualified Streamly.Internal.Data.Array.Foreign.Mut.Type as MA
45import qualified Streamly.Internal.Data.Array.Foreign.Mut.Type as MA
@@ -50,6 +51,7 @@ moduleName :: String
50moduleName = "Unicode.Stream"
51moduleName = "Unicode.Stream"
51
52
52-- | Copy file
53-- | Copy file
54+{-# NOINLINE copyCodecUtf8ArraysLenient #-}
53copyCodecUtf8ArraysLenient :: Handle -> Handle -> IO ()
55copyCodecUtf8ArraysLenient :: Handle -> Handle -> IO ()
54copyCodecUtf8ArraysLenient inh outh =
56copyCodecUtf8ArraysLenient inh outh =
55 S.fold (FH.write outh)
57 S.fold (FH.write outh)
@@ -75,6 +77,7 @@ o_1_space_decode_encode_chunked env =
75-- copy with group/ungroup transformations
77-- copy with group/ungroup transformations
76-------------------------------------------------------------------------------
78-------------------------------------------------------------------------------
77
79
80+{-# NOINLINE linesUnlinesCopy #-}
78linesUnlinesCopy :: Handle -> Handle -> IO ()
81linesUnlinesCopy :: Handle -> Handle -> IO ()
79linesUnlinesCopy inh outh =
82linesUnlinesCopy inh outh =
80 S.fold (FH.write outh)
83 S.fold (FH.write outh)
@@ -84,6 +87,7 @@ linesUnlinesCopy inh outh =
84 $ SS.decodeLatin1
87 $ SS.decodeLatin1
85 $ S.unfold FH.read inh
88 $ S.unfold FH.read inh
86
89
90+{-# NOINLINE linesUnlinesArrayWord8Copy #-}
87linesUnlinesArrayWord8Copy :: Handle -> Handle -> IO ()
91linesUnlinesArrayWord8Copy :: Handle -> Handle -> IO ()
88linesUnlinesArrayWord8Copy inh outh =
92linesUnlinesArrayWord8Copy inh outh =
89 S.fold (FH.write outh)
93 S.fold (FH.write outh)
@@ -93,6 +97,7 @@ linesUnlinesArrayWord8Copy inh outh =
93
97
94-- XXX splitSuffixOn requires -funfolding-use-threshold=150 for better fusion
98-- XXX splitSuffixOn requires -funfolding-use-threshold=150 for better fusion
95-- | Lines and unlines
99-- | Lines and unlines
100+{-# NOINLINE linesUnlinesArrayCharCopy #-}
96linesUnlinesArrayCharCopy :: Handle -> Handle -> IO ()
101linesUnlinesArrayCharCopy :: Handle -> Handle -> IO ()
97linesUnlinesArrayCharCopy inh outh =
102linesUnlinesArrayCharCopy inh outh =
98 S.fold (FH.write outh)
103 S.fold (FH.write outh)
@@ -122,6 +127,7 @@ linesUnlinesArrayUtf8Copy inh outh =
122-}
127-}
123
128
124-- | Word, unwords and copy
129-- | Word, unwords and copy
130+{-# NOINLINE wordsUnwordsCopyWord8 #-}
125wordsUnwordsCopyWord8 :: Handle -> Handle -> IO ()
131wordsUnwordsCopyWord8 :: Handle -> Handle -> IO ()
126wordsUnwordsCopyWord8 inh outh =
132wordsUnwordsCopyWord8 inh outh =
127 S.fold (FH.write outh)
133 S.fold (FH.write outh)
@@ -135,6 +141,7 @@ inspect $ hasNoTypeClasses 'wordsUnwordsCopyWord8
135#endif
141#endif
136
142
137-- | Word, unwords and copy
143-- | Word, unwords and copy
144+{-# NOINLINE wordsUnwordsCopy #-}
138wordsUnwordsCopy :: Handle -> Handle -> IO ()
145wordsUnwordsCopy :: Handle -> Handle -> IO ()
139wordsUnwordsCopy inh outh =
146wordsUnwordsCopy inh outh =
140 S.fold (FH.write outh)
147 S.fold (FH.write outh)
@@ -157,6 +164,7 @@ wordsUnwordsCopy inh outh =
157-- inspect $ 'wordsUnwordsCopy `hasNoType` ''Step
164-- inspect $ 'wordsUnwordsCopy `hasNoType` ''Step
158#endif
165#endif
159
166
167+{-# NOINLINE wordsUnwordsCharArrayCopy #-}
160wordsUnwordsCharArrayCopy :: Handle -> Handle -> IO ()
168wordsUnwordsCharArrayCopy :: Handle -> Handle -> IO ()
161wordsUnwordsCharArrayCopy inh outh =
169wordsUnwordsCharArrayCopy inh outh =
162 S.fold (FH.write outh)
170 S.fold (FH.write outh)
@@ -190,6 +198,7 @@ o_1_space_copy_read_group_ungroup env =
190-------------------------------------------------------------------------------
198-------------------------------------------------------------------------------
191
199
192-- | Copy file (encodeLatin1')
200-- | Copy file (encodeLatin1')
201+{-# NOINLINE copyStreamLatin1' #-}
193copyStreamLatin1' :: Handle -> Handle -> IO ()
202copyStreamLatin1' :: Handle -> Handle -> IO ()
194copyStreamLatin1' inh outh =
203copyStreamLatin1' inh outh =
195 S.fold (FH.write outh)
204 S.fold (FH.write outh)
@@ -202,11 +211,14 @@ inspect $ hasNoTypeClasses 'copyStreamLatin1'
202inspect $ 'copyStreamLatin1' `hasNoType` ''Step
211inspect $ 'copyStreamLatin1' `hasNoType` ''Step
203inspect $ 'copyStreamLatin1' `hasNoType` ''IUF.ConcatState -- FH.read/UF.concat
212inspect $ 'copyStreamLatin1' `hasNoType` ''IUF.ConcatState -- FH.read/UF.concat
204inspect $ 'copyStreamLatin1' `hasNoType` ''MA.ReadUState -- FH.read/A.read
213inspect $ 'copyStreamLatin1' `hasNoType` ''MA.ReadUState -- FH.read/A.read
214+
215+inspect $ 'copyStreamLatin1' `hasNoType` ''Fold.Step
205inspect $ 'copyStreamLatin1' `hasNoType` ''AT.ArrayUnsafe -- FH.write/writeNUnsafe
216inspect $ 'copyStreamLatin1' `hasNoType` ''AT.ArrayUnsafe -- FH.write/writeNUnsafe
206inspect $ 'copyStreamLatin1' `hasNoType` ''Strict.Tuple3' -- FH.write/chunksOf
217inspect $ 'copyStreamLatin1' `hasNoType` ''Strict.Tuple3' -- FH.write/chunksOf
207#endif
218#endif
208
219
209-- | Copy file (encodeLatin1)
220-- | Copy file (encodeLatin1)
221+{-# NOINLINE copyStreamLatin1 #-}
210copyStreamLatin1 :: Handle -> Handle -> IO ()
222copyStreamLatin1 :: Handle -> Handle -> IO ()
211copyStreamLatin1 inh outh =
223copyStreamLatin1 inh outh =
212 S.fold (FH.write outh)
224 S.fold (FH.write outh)
@@ -219,6 +231,8 @@ inspect $ hasNoTypeClasses 'copyStreamLatin1
219inspect $ 'copyStreamLatin1 `hasNoType` ''Step
231inspect $ 'copyStreamLatin1 `hasNoType` ''Step
220inspect $ 'copyStreamLatin1 `hasNoType` ''IUF.ConcatState -- FH.read/UF.concat
232inspect $ 'copyStreamLatin1 `hasNoType` ''IUF.ConcatState -- FH.read/UF.concat
221inspect $ 'copyStreamLatin1 `hasNoType` ''MA.ReadUState -- FH.read/A.read
233inspect $ 'copyStreamLatin1 `hasNoType` ''MA.ReadUState -- FH.read/A.read
234+
235+inspect $ 'copyStreamLatin1 `hasNoType` ''Fold.Step
222inspect $ 'copyStreamLatin1 `hasNoType` ''AT.ArrayUnsafe -- FH.write/writeNUnsafe
236inspect $ 'copyStreamLatin1 `hasNoType` ''AT.ArrayUnsafe -- FH.write/writeNUnsafe
223inspect $ 'copyStreamLatin1 `hasNoType` ''Strict.Tuple3' -- FH.write/chunksOf
237inspect $ 'copyStreamLatin1 `hasNoType` ''Strict.Tuple3' -- FH.write/chunksOf
224#endif
238#endif
@@ -239,6 +253,7 @@ inspect $ hasNoTypeClasses '_copyStreamUtf8'
239#endif
253#endif
240
254
241-- | Copy file
255-- | Copy file
256+{-# NOINLINE copyStreamUtf8 #-}
242copyStreamUtf8 :: Handle -> Handle -> IO ()
257copyStreamUtf8 :: Handle -> Handle -> IO ()
243copyStreamUtf8 inh outh =
258copyStreamUtf8 inh outh =
244 S.fold (FH.write outh)
259 S.fold (FH.write outh)