lua-users home
lua-l archive

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

I like to clarify what i mean was overhead using variables & functions using metatable __index OOP method.
something like
acc = Account:new()
-- how much performance overhead i get with something like this
acc.Balance = 100
Also like to know if using LuaJIT overhead between these two methods lowers? Because like to use best possible method performance wise in my whole code because i'll be using objects alot.
----- Original Message -----
Sent: Monday, October 10, 2005 10:33 AM
Subject: Performance overhead using __index?

I was wondering how much performance overhead is there when using metatable __index?
Meaning how much slower it is to use metatables + __index?
I plan to use this
function Account:new (o)
      o = o or {}
      setmetatable(o, self)
      self.__index = self
      return o
or this
function Account:new (o)
    o = o or {}
    Table.Copy(o, self) -- copies self to o
    return o