lua-users home
lua-l archive

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


On Thu, Aug 7, 2014 at 11:14 AM, Mason Mackaman <masondeanm@aol.com> wrote:
> Also doesn’t there have to be some emphasis on the locality (can I say that?) of getmetatable(‘’).__index, otherwise it wouldn’t be any faster?

No, there doesn't. The table lookup (__index) is neither local nor
global, it's a table lookup. And the implicit metatable access doesn't
have ANY overhead at all -- the metatable is just a field on the
object's internal structure. Obviously calling getmetatable() yourself
has the overhead of looking up the getmetatable() function and the
function call itself.

/s/ Adam