lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


2012/6/22 Miles Bader <miles@gnu.org>:
> To get a bit better idea I tried the a simple benchmark that just
> calls "strcmp" a bunch of times (on varying strings) in a loop.  I
> then wrote an equivalent "classic Lua C module", and tried that
> too.  I imagine this mostly measures the speed of the argument
> marshalling etc in LuaFFI.
>
> In this simple test LuaFFI didn't do too bad; the "classic Lua C
> module" version is only about three times as fast as the "LuaFFI"
> version (in LuaJIT, of course, the FFI benchmark is about 10 times
> faster than the "classic Lua C module").

Nice that you have made the tests. Like Galileo Galilei I believe that
is better to do measurements instead of claiming the truth ;-)

I guess that just the overhead of checking the metatable for each
cdata represented as a userdata pretty much slowdown everything.
Probably this is the first thing that you can optimize with native
language support for FFI.

> Nonetheless, I think more core support would be necessary to get
> around the portability issues (if that's even possible, though my
> guess it is for at least some reasonable subset of the functionality).

I guess this discussion will not bring us anywhere if neither Roberto
or Luiz step forward to say a word on this idea :-)

I was thinking to make a power patch to Lua myself but I don't have
the time to work on that. In addition I probably lack also the
required knowledge of the Lua internals...

Francesco