On Wed, Apr 13, 2011 at 9:05 AM, Michael Gogins
<michael.gogins@gmail.com> wrote:
Fantastic, thank you again for this work, which I expect to make significant use of over the next few years.
Just to be perfectly clear, instead of defining a class in Lua as a Lua table with metamethods, one can define a class in LuaJIT+FFI as a C struct with metamethods. In that case, field access and method calls will be roughly as fast as possible on that architecture.
Is that correct?
What about inheritance and virtual methods, then?
Regards,
Mike
On Wed, Apr 13, 2011 at 6:23 AM, Mike Pall
<mikelu-1104@mike.de> wrote:
Michael Gogins wrote:
> What is "reasonable efficiency" compared to native C/C++ code?
Field access and dispatch to metamethods is 'free', just like
field access and dispatch to non-virtual methods in C++. It
depends more on what you do in the methods. Straightforward code,
such as self.x=self.x+1 compiles to the same code as in C++. YMMV.
--Mike
--
Michael Gogins
Irreducible Productions
http://www.michael-gogins.comMichael dot Gogins at gmail dot com