[MLton] Int Overflow detection
Sat, 19 Mar 2005 10:46:24 -0800
> But I think the "problems" it exposes could help the typical SML
> program as well. All programs have loops, and most computation time
> is spent in loops. In SML people don't see them as much since they
> are hidden behind our folds, and maps but they are there.
You are correct. In fact, transforming functional programs into loops
is something that MLton does very well.
> And given the high tech representations that mlton has perhaps some
> of these optimizations would not be incredibly difficult to
Unfortunately, we haven't taken advantage of loops nearly as much as
we should have. Some folks gave a pretty good try at implement
SSA-PRE in MLton, which in principle should enable a lot of code
motion. But it never got beyond the experimental stage.
One problem with code motion in SML is that precise overflow detection
disables a lot of it, or at least makes it a lot harder. And it's
probably not worth the effort to focus on the 'detectOverflow false'
case, since that violates the semantics of SML.
Anyways, X86 definitely comes to our rescue. Even for your pretty bad
case, we see a slowdown from 2.44s to 3.51s, i.e. 44%. BTW, how much
worse is it with overflow detection on?