[Larceny-users] long long and unsigned long long in the FFI

David Rush kumoyuki at gmail.com
Mon Jul 23 19:37:25 EDT 2007


It's the happy FFI pest again -

I've been cruising merrily along wrapping up the MySQL API with the
Larceny FFI and I am glad to say I have raw DB speed that is closely
comparable to Ruby on Rails now. My original tests using CommonLarceny
and the MySQL .NET adapter were nearly 16x slower! Now I'm pretty sure
that I'm approaching the noise floor of different console I/O
processing in Larceny and different subset of the MySQL API being
utilized in Rails.

But...

There's at least one function which will be moderately important to me
which returns unsigned 64 bit integers (to retrieve DB-assigned record
IDs). Now I think I mostly see how to hack this in (even to the point
of hand-assembling code for ffi-i386.sch), but testing it properly
will be nasty under my current environment - *and* I can only test
x86/win with my current hardware.

I bring this up since I see no way of doing this without hitting
several files in the core larceny distribution - so I'm wondering if a
patch may already be in place, or coming very soon in SVN. If there
isn't, would the skeletal work I can provide be useful enough to roll
it back into the codebase, even without support across the full suite
of platforms?

On a related note: I looked at doing an array type constructor for
std-ffi.sch and decided that the pain was not worth the gain since I
only receive char** as a return value and there is adequate support
for that in the void*-rt structure. But that case points out a major
reason why supporting an array type constructor could be very
difficult for a C-callout. You clearly need additional run-time
support to correctly map the internal pointers used for the C vector's
reference to the actual strings. Yes, you can get it right - up until
the collector moves the bytevector you allocate to store the text :P

I fear I'm starting to sound a little like Brad Lucier on the Gambit
list. What can I say? I'm really happy with Larceny so now I'm getting
the itch to make it better :)

Thanks for the good work.

david
-- 
Once you label me, you negate me
    - Soren Kierkegaard



More information about the Larceny-users mailing list