[MLton-devel] basis library benchmarks

Matthew Fluet Matthew Fluet <fluet@CS.Cornell.EDU>
Wed, 31 Jul 2002 17:03:32 -0400 (EDT)


> Looks good to me.  It's probably worth optimizing concat a little
> since it is so comman.

Probably.  I'm also thinking of writing a specialized concat2 for
String.^.  

The downside of whole-program optimization is nailing down exactly why
something does or doesn't get optimized isn't easy.  I was looking at the
fib benchmark, which I couldn't understand where 3kb of extra code was
coming from.  Looking at the final .SSA, the exit function wasn't inlined
into main, which meant that it couldn't optimize away most of the exit
code because the exit arguments are known in main.  And, the reason that
it couldn't inline exit was that the function was too big.  And the reason
why the function was bigger was because concat was bigger than under the
old basis.  Part of this is due to the concat issue above, but not all.
The bigger problem is the usesCallcc reference to get tabulate to work in
the presence of callcc.  As best I can make out, because String is derived
from CharVector (instead of using it's own invocation of the sequence
functor), then the code for CharVector.concat is really the code for
Vector.concat -- i.e., the polmorphic vector code.  Now, here's the part I
don't understand fully: under basis-1997, inferSimplify eliminates the
usesCallcc refernce, but under basis-2002, it does not.  The only
difference I can see is that under basis-1997 it's in a monomorphic
context, while under basis-2002 it's in a polymorphic context.  So,
usesCallcc sticks around for a while, getting past around in environments
(which seems odd, because it's global) and cascading through the
optimizations.  It's eventually elminated, but by the end, it's thrown
enough things off so that the code isn't quite as small as it was before.

> Have you looked into implementing "-basis-library {2002|1997|none}"?

Not at all.  In fact, having removed some of the String_* primitives from
the basis-2002 branch, the current basis won't compile.  It ought to be
easy enough to back port the string/char vector changes from this branch
to the old branc, in which case we could just have two implementations
lying around.  The alternative is to "implement" the 1997 basis in terms
of the 2002 basis.  Giving the old array and vector structures should be
easy enough, and that accounts for all the type errors I've discovered in
the regressions and benchmarks.  Then there are the more minor changes;
for example, I can't really imagine any program crucially relying on the
fact that Real.fromString does not accept "+inf", but under the old basis,
symbolic reals weren't scanned.  The nan_modes under IEEEReal also
changed.



-------------------------------------------------------
This sf.net email is sponsored by: Dice - The leading online job board
for high-tech professionals. Search and apply for tech jobs today!
http://seeker.dice.com/seeker.epl?rel_code=31
_______________________________________________
MLton-devel mailing list
MLton-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mlton-devel