[MLton] Number theory and MLton C FFI

Brent Fulgham bfulg@pacbell.net
Thu, 21 Oct 2004 10:16:34 -0700 (PDT)


--- "Wesley W. Terpstra" wrote:

> No offence to sml, but these operations simply must
> be performed in assembler-style C in order to be 
> efficient.

I'm interested in the kinds of coding constructs
that can't be efficiently performed in SML both
to (1) help identify problems with the MLton compiler,
and (2) to devise fiendish tests for the Shootout
(http://shootout.alioth.debian.org).

In general, I find that SML performs quite well in
the tests, but perhaps we are not testing certain
kinds of real-world problems properly.

Can you provide any (small) examples of what you have
observed?

> What I would like to be able to do now is to replace
> the prototype transforms I wrote in SML (for 
> conformance checking of the C code) with calls to
the
> optimized C equivalents. Then I could continue to
use
> my abstract SML code, but benefit from the optimized
> performance.

This is basically how the MLton runtime library 
implements its lowest-level primitives.  But will
the C FFI overhead reduce the benefit of this
approach (assuming you can work around the tuple
issues you mention)?

-Brent