Skip to content

inlining happens on foldl1 and does not happen on direct application of combinator

This is certainly related to #3736 (closed).

The code can be found at: http://code.haskell.org/storablevector/speedtest/SpeedTestChorus.hs

Look into functions mainChunky1MixFold and mainChunky1MixFlat. The first one does

foldl1 mixVec $ map (uncurry tone0) $ [(f0,p0), (f1,p1), (f2,p2)]

and generator0Freq gets inlined and is fast. (1.4 seconds) The second one does

tone0 f0 p0 `mixVec` tone0 f1 p1 `mixVec` tone0 f2 p2

and generator0Freq is not inlined and this is slower (2.0 seconds). (Inlining or specialising mixVec doesn't change the numbers. I tried that because I first thought, mixVec would be the problem.)

But we cannot derive from it, that using 'foldl1' is better in general. Since if you compare mainMonolithic1GeneratorFold with mainMonolithic1Generator, you find that the fold version is slower (2.8 seconds vs. 2.0 seconds).

Trac metadata
Trac field Value
Version 6.10.4
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC ghc@henning-thielemann.de
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information