[MLton] Performance of Real.toInt
Ryan Newton
rrnewton at gmail.com
Fri Oct 24 13:50:08 PDT 2008
Hello,
My compiler uses either SML or C as a backend. There's one
application right now where SML/MLton is getting crushed. It's a
computer vision app where the core computation involves updating
histograms -- picking a location in some space (inexact) and then
discretizing (truncating a floating point number).
The truncation in the source language happens by converting the floats
to ints. Under MLton I generate code like this:
(Real64.toInt IEEEReal.TO_ZERO (var_tmpsmp_77))
But it performs very poorly. I haven't researched this, but if I had
to guess, I'd bet this is because mlton is implementing some more
semantically meaningful notion than C casts. Nevertheless, is there
any inexpensive way to ape the behavior one gets from (int)x in C?
-Ryan
More information about the MLton
mailing list