knownCase pass
Stephen Weeks
MLton@sourcelight.com
Wed, 16 Jan 2002 17:47:52 -0800
> Out of curiosity, I wrote a little benchmark that repeatedly took
> the last of a long list and compared with and without knownCase.
> Disappointingly, almost no improvement.
It might help if MLton could delay the select of the integer so that
it is outside the loop, and only happens for the last element. But
that optimization is only expressible in RSSA and later ILs.
> After unrolling the loop a little, the restore pass introduces a variable
> to track the last seen element of the list, which avoids the need for
> repeated cons tests.
Neat. For a minute I was worried that "repeated cons tests" was
pointing to a bug in the match compiler. But they're across loops, so
that's OK.