[commit: ghc] master: Improve eta expansion (again) (802f4b8)
git at git.haskell.org
git at git.haskell.org
Tue Nov 12 15:07:35 UTC 2013
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/802f4b89c1a823f7d530454d52bca80b13fb2f15/ghc
>---------------------------------------------------------------
commit 802f4b89c1a823f7d530454d52bca80b13fb2f15
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date: Tue Nov 12 13:12:16 2013 +0000
Improve eta expansion (again)
The presenting issue was that we were never eta-expanding
f (\x -> case x of (a,b) -> \s -> blah)
and that meant we were allocating two lambdas instead of one.
See Note [Eta expanding lambdas] in SimplUtils.
However I didn't want to eta expand the lambda, and then try all over
again for tryEtaExpandRhs. Yet the latter is important in the context
of a let-binding it can do simple arity analysis. So I ended up
refactoring CallCtxt so that it tells when we are on the RHS of a let.
I also moved findRhsArity from SimplUtils to CoreArity.
Performance increases nicely. Here are the ones where allocation improved
by more than 0.5%. Notice the nice decrease in binary size too.
--------------------------------------------------------------------------------
Program Size Allocs Runtime Elapsed TotalMem
--------------------------------------------------------------------------------
ansi -2.3% -0.9% 0.00 0.00 +0.0%
bspt -2.1% -9.7% 0.01 0.01 -33.3%
fasta -1.8% -11.7% -3.4% -3.6% +0.0%
fft -1.9% -1.3% 0.06 0.06 +11.1%
reverse-complem -1.9% -18.1% -1.9% -2.8% +0.0%
sphere -1.8% -4.5% 0.09 0.09 +0.0%
transform -1.8% -2.3% -4.6% -3.1% +0.0%
--------------------------------------------------------------------------------
Min -3.0% -18.1% -13.9% -14.6% -35.7%
Max -1.3% +0.0% +7.7% +7.7% +50.0%
Geometric Mean -1.9% -0.6% -2.1% -2.1% -0.2%
>---------------------------------------------------------------
802f4b89c1a823f7d530454d52bca80b13fb2f15
compiler/coreSyn/CoreArity.lhs | 111 ++++++++++++++++++++++++----
compiler/coreSyn/CoreUnfold.lhs | 70 ++++++++++--------
compiler/simplCore/SimplUtils.lhs | 144 ++++++++++++-------------------------
compiler/simplCore/Simplify.lhs | 21 +++---
4 files changed, 198 insertions(+), 148 deletions(-)
Diff suppressed because of size. To see it, use:
git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 802f4b89c1a823f7d530454d52bca80b13fb2f15
More information about the ghc-commits
mailing list