effect of order of function arguments

Simon Peyton-Jones simonpj@microsoft.com
Wed, 19 Feb 2003 14:32:30 -0000


| GHC used to have an optimisation for static argument like this. It
would
| turn both of the above programs into a similar form using a local
| recursive function:
|=20
| interp y xs =3D interpaux xs
|   where interpaux [] =3D []
| 	interpaux (x:[]) =3D x:[]
|         interpaux (x:xs) =3D x:y:interpaux xs
|=20
| GHC doesn't do this anymore. The reason for this is unknown to me.

It turned out to be a very minor effect (1-2% of execution time) and
hard to tune; with lots of parameters, it's best to make a local
function, with just a few it's best to pass the parameters round.

S