[MLton] Re: [MLton-user] FFI and pointer relocation

Wesley W. Terpstra wesley at terpstra.ca
Mon Nov 26 15:51:35 PST 2007


On Nov 26, 2007, at 11:10 PM, Matthew Fluet wrote:
>> For now I'll just allocate the cell in C and export a C function to  
>> check if the cell has changed.
>
> If there is only one cell (which can be statically allocated), then  
> using MLton's  _address  (with the MLton.Pointer structure) or   
> _symbol  FFI may be more efficient.  There is a slight overhead in  
> making a C call, and if you are simply checking the cell's contents,  
> then the above can all be done without leaving (the generated) ML  
> code.

Why doesn't the current runtime use this trick, actually? I'm thinking  
of the especially slow gettimeofday() (and NetHost/ServDB, etc).

On the topic of gettimeofday, isn't Time.time as an IntInf instead of  
an Int64 a bit costly?

Would this be an area where "patches are welcome"? :-)




More information about the MLton mailing list