id summary reporter owner description type status priority milestone component version resolution keywords cc os architecture failure testcase blockedby blocking related differential wikipage
888 Implement the static argument transformation simonpj "The Static Argument transformation optimises
{{{
f x y = ....f x' y...
}}}
into
{{{
f x y = let g x = ....g x'...
in g x
}}}
Instead of passing {{{y}}} along unchanged, we make it into a free variable of a local function definition {{{g}}}.
Unfortunately, it's not always a win. Andre Santos gives a discussion, and quite a few numbers in [http://research.microsoft.com/%7Esimonpj/Papers/santos-thesis.ps.gz his thesis].
But sometimes it is a pretty big win. Here's the example that recently motivated me, which Roman Leshchinskiy showed me. You need the attached file Stream.hs, and then try compiling
{{{
import Stream
foo :: (a -> b) -> [a] -> [c]
foo f = mapL f
}}}
Thus inspired, I think I have a set of criteria that would make the static arg transformation into a guaranteed win:
* there is only one (external) call to the function
* OR its RHS is small enough to inline
* OR it is marked INLINE (?)
So I'd like to try this idea out." task new normal Compiler 6.4.2 StaticArgumentTransformation Bulat.Ziganshin@… johan.tibell@… hackage.haskell.org@… reiner.pope@… Jake.McArthur@… choener@… dterei maoe Unknown/Multiple Unknown/Multiple None/Unknown N/A