[MLton] speeding up Real.abs

Daniel C. Wang danwang@CS.Princeton.EDU
Tue, 20 Dec 2005 20:54:33 -0800

It would be nice if this new structure call it "NativeReal" or 
"FastReal" had a compatible same signature as "Real".

Then if I really don't care about ieee I can just say
structure Real =  structure FastReal;

and be done with it for 90% of the cases or selectively pick and choose.

Stephen Weeks wrote:

>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?
>MLton mailing list