-
Simon Peyton Jones authored
---------------------------------------- Be a bit less gung ho about let-floating ---------------------------------------- Sometimes it's a bad idea to float cheap expressions outwards, even if they escape a value lambda. -- Even if it escapes a value lambda, we only -- float if it's not cheap (unless it'll get all the -- way to the top). I've seen cases where we -- float dozens of tiny free expressions, which cost -- more to allocate than to evaluate. -- NB: exprIsCheap is also true of bottom expressions, which -- is good; we don't want to share them -- -- It's only Really Bad to float a cheap expression out of a -- strict context, because that builds a thunk that otherwise -- would never be built. So another alternative would be to -- add -- || (strict_ctxt && not (exprIsBottom expr)) -- to the condition above. We should really try this out. The relevant function is lvlMFE, which has been subject to a lot of fiddling over the years. Probably this isn't the last time. This all actually showed up when I was compiling IA.lhs from Ian Lynagh.
6346938c