on master help sign in
Add INLINE phase annotations on some functions
commit0d586750a769b358943c355ca0447a799fc17e65 authorHarendra Kumar <harendra@composewell.com> dateWed 8 Jul 2020, 03:06 (6 years ago) parent53504db
1 file changed+10−3
benchmark/Streamly/Benchmark/FileSystem/Handle.hs+10−3
benchmark/Streamly/Benchmark/FileSystem/Handle.hs+10−3
@@ -485,18 +485,25 @@ inspect $ 'readSumBytes `hasNoType` ''AT.FlattenState
485485inspect $ 'readSumBytes `hasNoType` ''D.ConcatMapUState
486486#endif
487487
488−{-# INLINE readDrain #-}
488+-- XXX If we have two benchmarks using S.drain in one benchmark group then
489+-- somehow GHC ends up delaying the inlining of readDrain. since S.drain has an
490+-- INLINE[2] for proper rule firing, that does not work well because of delyaed
491+-- inlining and the code does not fuse. We need some way of propagating the
492+-- inline phase information up so that we can expedite inlining of the callers
493+-- too automatically. The minimal example for the problem can be created by
494+-- using just two benchmarks in a bench group both using "readDrain".
495+{-# INLINE[2] readDrain #-}
489496readDrain :: Handle -> IO ()
490497readDrain inh = S.drain $ S.unfold FH.read inh
491498
492−{-# INLINE readDecodeLatin1 #-}
499+{-# INLINE[2] readDecodeLatin1 #-}
493500readDecodeLatin1 :: Handle -> IO ()
494501readDecodeLatin1 inh =
495502 S.drain
496503 $ SS.decodeLatin1
497504 $ S.unfold FH.read inh
498505
499−{-# INLINE readDecodeUtf8Lax #-}
506+{-# INLINE[2] readDecodeUtf8Lax #-}
500507readDecodeUtf8Lax :: Handle -> IO ()
501508readDecodeUtf8Lax inh =
502509 S.drain