Version française
Home     About     Download     Resources     Contact us    
Browse thread
RE: questions about costs of nativeint vs int
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Brent Fulgham <brent.fulgham@x...>
Subject: RE: questions about costs of nativeint vs int
> Do you have any plans to implement unboxed native integers?
>

There's an interesting paper on the Caml site discussing the
performance issues of boxed/unboxed values.  From a performance
standpoint I believe it indicated boxed values were a better
tradeoff (between performance/flexibility), though the C
integration issues you mention below were not (IIRC) discussed.
 
> I would really have liked to see this happen, because it 
> would have made integration with C both easier and more efficient.
> 

Couldn't a wrapper generator of some kind make this less
problematic?

For instance, the MzScheme implementation provides various C
Macros and other tools to get at the boxed values:

int scheme_get_int_val(Scheme_Object* v);

And some predicates to decide what kind of object you are dealing
with:

int SCHEME_INTP(Scheme_Object* v);	// Returns true/false.

SWIG can be used to auto-generate interface code using these
routines to provide a C/Scheme bridge.

This should be possible in OCaml as well.

-Brent