lua-users home
lua-l archive

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


On Tue, Mar 22, 2011 at 04:06, Tim Menzies <tim@menzies.us> wrote:
> sorry if this is an FAQ but looking at
> http://lua-users.org/wiki/ObjectBenchmarkTests, it seems that:

> 1)  the standard ways of doing OO in Lua has a large overhead.

> 2) best way seems to the "closure method"

Slowest object creation time, fastest call speed, AFAIR — with plain Lua.

> anyone got a comment on that?

> does not matter how the OO stuff is done?

> and when folks optimize a slow  Lua script, is the *first* thing that
> they look at is the class system and change that? or...?

Premature optimization.

In my practice I can't remember a case when OO stuff was a bottleneck
in Lua code — in whole system. You find something to be slow — by
doing actual profiling! — you optimize it. Sometimes — rarely — you
may have to optimize out OO — but in one specific place, not
throughout whole program.

Think about code readability and about getting things done.
Performance is secondary to that, most of the time.

Alexander.