[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Method call Performance (Was Re: OOP in daydream...)
- From: duck <duck@...>
- Date: Wed, 19 Jan 2005 12:01:08 +0000
> It's interesting to compare various ways of implementing
> inheritance in lua.
> Here are some numbers:
> - global function call 1.0
> - copying methods into class 1.5
> - custom __index function 5.0 (!)
> - nested metatables 2.0
> In summary; method dispatch isn't too bad, unless
> you use a custom function to look up symbols.
> Generally keeping 'fat' classes (that include all
> methods) is better; this will not depend on
> the depth of inheritance.
Good, I like 'fat' classes...that's mostly through ignorance of how else
to do it, but now I have a performance justification :-)
> Of course, your mileage may vary...
Nautical, Roman, Imperial or Country miles?