[MLton] speeding up Real.abs

Stephen Weeks MLton@mlton.org
Tue, 20 Dec 2005 15:24:47 -0800


I just posted something on MLton-user showing a big performance hit
for Real.abs.  The performance hit is enough that it seems worth
exposing the faster version to users somehow.  One possibility is to
have a flag, like MLton.safe, that governs how pedantic the
implementation of Real is in following the spec.  We already have
-ieee-fp, which perhaps suffices, but maybe not.  Another approach is
to have a special structure, like Unsafe.Array, that contains fast,
but not so pedantic, versions of some of the Real functions.  That
way, one could selectively replace only the ones in hot loops and only
when profiling demonstrates that it's necessary.

Does anyone have other ideas on what we might do?