lua-users home
lua-l archive

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

On Mon, May 25, 2009 at 7:46 PM, Petite Abeille <> wrote:
> I, for one, use FuncTable all over the place :)
> for aContact in aDB( 'select * from contact' ) do
>    print(, )
> end

That is indeed cool. It's true that Lua people don't use standard OOP
so much because it's so easy to create closures of various types.

My unscientific tests here show that there's only a 35% penalty for a
table call over a straight local call, and a 45% penalty for a
standard OOP call (i.e. metatable lookup). Straight lookup (object
contains methods) is a 35% penalty.  Now microbenchmarks are to be
taken with lots of sodium chloride, but this does give an upper bound
on the penalty, since these are trivial function calls, and usually
the body will actually do some work ;)

So, not bad at all!  But it would be nice if the standard library
respected __call.

steve d.