perf: Replace uses of genericLength with strictGenericLength
genericLength is a recursive function and marked NOINLINE. It is not going to specialise. In profiles, it can be seen that 3% of total compilation time when computing bytecode is spend calling this non-specialised function. In addition, we can simplify `addListToSS` to avoid traversing the input list twice and also allocating an intermediate list (after the call to reverse). Overall these changes reduce the time spend in 'assembleBCOs' from 5.61s to 3.88s. Allocations drop from 8GB to 5.3G. Fixes #25706
Showing
- compiler/GHC/ByteCode/Asm.hs 2 additions, 2 deletionscompiler/GHC/ByteCode/Asm.hs
- compiler/GHC/Prelude/Basic.hs 14 additions, 0 deletionscompiler/GHC/Prelude/Basic.hs
- compiler/GHC/StgToByteCode.hs 5 additions, 5 deletionscompiler/GHC/StgToByteCode.hs
- libraries/ghc-boot/GHC/Data/SizedSeq.hs 7 additions, 4 deletionslibraries/ghc-boot/GHC/Data/SizedSeq.hs
Loading
Please register or sign in to comment