on master help sign in
Use NOINLINE on some benchmarks

These benchmarks degraded because of the terminating folds change because INLINing was causing loop fusion to break.

commit8358095df12a3c4b9f2c45884d38465e9c47c141 authorHarendra Kumar <harendra@composewell.com> dateTue 27 Oct 2020, 01:06 (6 years ago) parent0bf8b54
1 file changed+16
benchmark/Streamly/Benchmark/FileSystem/Handle/ReadWrite.hs+16
benchmark/Streamly/Benchmark/FileSystem/Handle/ReadWrite.hs+16
@@ -338,6 +338,7 @@ o_1_space_copy_fromBytes env =
338338 ]
339339
340340-- | Send the file contents ('defaultChunkSize') to /dev/null
341+{-# NOINLINE writeReadWithBufferOf #-}
341342writeReadWithBufferOf :: Handle -> Handle -> IO ()
342343writeReadWithBufferOf inh devNull = IUF.fold unf fld (defaultChunkSize, inh)
343344
@@ -355,6 +356,7 @@ inspect $ 'writeReadWithBufferOf `hasNoType` ''AT.ArrayUnsafe -- FH.write/writeN
355356#endif
356357
357358-- | Send the file contents ('AT.defaultChunkSize') to /dev/null
359+{-# NOINLINE writeRead #-}
358360writeRead :: Handle -> Handle -> IO ()
359361writeRead inh devNull = IUF.fold unf fld inh
360362
@@ -386,6 +388,7 @@ o_1_space_copy env =
386388-------------------------------------------------------------------------------
387389
388390-- | Send the file contents to /dev/null with exception handling
391+{-# NOINLINE readWriteOnExceptionUnfold #-}
389392readWriteOnExceptionUnfold :: Handle -> Handle -> IO ()
390393readWriteOnExceptionUnfold inh devNull =
391394 let readEx = IUF.onException (\_ -> hClose inh) FH.read
@@ -397,6 +400,7 @@ inspect $ hasNoTypeClasses 'readWriteOnExceptionUnfold
397400#endif
398401
399402-- | Send the file contents to /dev/null with exception handling
403+{-# NOINLINE readWriteHandleExceptionUnfold #-}
400404readWriteHandleExceptionUnfold :: Handle -> Handle -> IO ()
401405readWriteHandleExceptionUnfold inh devNull =
402406 let handler (_e :: SomeException) = hClose inh >> return 10
@@ -409,6 +413,7 @@ inspect $ hasNoTypeClasses 'readWriteHandleExceptionUnfold
409413#endif
410414
411415-- | Send the file contents to /dev/null with exception handling
416+{-# NOINLINE readWriteFinally_Unfold #-}
412417readWriteFinally_Unfold :: Handle -> Handle -> IO ()
413418readWriteFinally_Unfold inh devNull =
414419 let readEx = IUF.finally_ (\_ -> hClose inh) FH.read
@@ -419,12 +424,14 @@ inspect $ hasNoTypeClasses 'readWriteFinally_Unfold
419424-- inspect $ 'readWriteFinallyUnfold `hasNoType` ''Step
420425#endif
421426
427+{-# NOINLINE readWriteFinallyUnfold #-}
422428readWriteFinallyUnfold :: Handle -> Handle -> IO ()
423429readWriteFinallyUnfold inh devNull =
424430 let readEx = IUF.finally (\_ -> hClose inh) FH.read
425431 in S.fold (FH.write devNull) $ S.unfold readEx inh
426432
427433-- | Send the file contents to /dev/null with exception handling
434+{-# NOINLINE readWriteBracket_Unfold #-}
428435readWriteBracket_Unfold :: Handle -> Handle -> IO ()
429436readWriteBracket_Unfold inh devNull =
430437 let readEx = IUF.bracket_ return (\_ -> hClose inh) FH.read
@@ -435,6 +442,7 @@ inspect $ hasNoTypeClasses 'readWriteBracket_Unfold
435442-- inspect $ 'readWriteBracketUnfold `hasNoType` ''Step
436443#endif
437444
445+{-# NOINLINE readWriteBracketUnfold #-}
438446readWriteBracketUnfold :: Handle -> Handle -> IO ()
439447readWriteBracketUnfold inh devNull =
440448 let readEx = IUF.bracket return (\_ -> hClose inh) FH.read
@@ -463,12 +471,14 @@ o_1_space_copy_read_exceptions env =
463471-------------------------------------------------------------------------------
464472
465473-- | Send the file contents to /dev/null with exception handling
474+{-# NOINLINE readWriteOnExceptionStream #-}
466475readWriteOnExceptionStream :: Handle -> Handle -> IO ()
467476readWriteOnExceptionStream inh devNull =
468477 let readEx = S.onException (hClose inh) (S.unfold FH.read inh)
469478 in S.fold (FH.write devNull) $ readEx
470479
471480-- | Send the file contents to /dev/null with exception handling
481+{-# NOINLINE readWriteHandleExceptionStream #-}
472482readWriteHandleExceptionStream :: Handle -> Handle -> IO ()
473483readWriteHandleExceptionStream inh devNull =
474484 let handler (_e :: SomeException) = S.yieldM (hClose inh >> return 10)
@@ -476,11 +486,13 @@ readWriteHandleExceptionStream inh devNull =
476486 in S.fold (FH.write devNull) $ readEx
477487
478488-- | Send the file contents to /dev/null with exception handling
489+{-# NOINLINE readWriteFinally_Stream #-}
479490readWriteFinally_Stream :: Handle -> Handle -> IO ()
480491readWriteFinally_Stream inh devNull =
481492 let readEx = IP.finally_ (hClose inh) (S.unfold FH.read inh)
482493 in S.fold (FH.write devNull) readEx
483494
495+{-# NOINLINE readWriteFinallyStream #-}
484496readWriteFinallyStream :: Handle -> Handle -> IO ()
485497readWriteFinallyStream inh devNull =
486498 let readEx = S.finally (hClose inh) (S.unfold FH.read inh)
@@ -504,6 +516,7 @@ fromToBytesBracketStream inh devNull =
504516 (\_ -> IFH.toBytes inh)
505517 in IFH.fromBytes devNull $ readEx
506518
519+{-# NOINLINE readWriteBeforeAfterStream #-}
507520readWriteBeforeAfterStream :: Handle -> Handle -> IO ()
508521readWriteBeforeAfterStream inh devNull =
509522 let readEx =
@@ -511,11 +524,13 @@ readWriteBeforeAfterStream inh devNull =
511524 $ IP.before (hPutChar devNull 'A') (S.unfold FH.read inh)
512525 in S.fold (FH.write devNull) readEx
513526
527+{-# NOINLINE readWriteAfterStream #-}
514528readWriteAfterStream :: Handle -> Handle -> IO ()
515529readWriteAfterStream inh devNull =
516530 let readEx = IP.after (hClose inh) (S.unfold FH.read inh)
517531 in S.fold (FH.write devNull) readEx
518532
533+{-# NOINLINE readWriteAfter_Stream #-}
519534readWriteAfter_Stream :: Handle -> Handle -> IO ()
520535readWriteAfter_Stream inh devNull =
521536 let readEx = IP.after_ (hClose inh) (S.unfold FH.read inh)
@@ -674,6 +689,7 @@ wordsUnwordsCopy inh outh =
674689-- inspect $ 'wordsUnwordsCopy `hasNoType` ''Step
675690#endif
676691
692+{-# NOINLINE wordsUnwordsCharArrayCopy #-}
677693wordsUnwordsCharArrayCopy :: Handle -> Handle -> IO ()
678694wordsUnwordsCharArrayCopy inh outh =
679695 S.fold (FH.write outh)