lua-users home
lua-l archive

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



On Mon, Jul 5, 2010 at 3:53 PM, Joshua Jensen <jjensen@workspacewhiz.com> wrote:
 ----- Original Message -----
From: HyperHacker
Date: 7/5/2010 7:51 AM
On Mon, Jul 5, 2010 at 06:41, Brian Weed<brianw@imaginengine.com>  wrote:
Lua is probably quite fast already even if you only use global
variables, ie, don't bother with locals.

That's been our experience.

We use Lua to script almost all of our games, and we've never once
localized a global (for performance, or any other reason), because it's
not a bottleneck, and we don't waste time "optimizing" stuff that's not
a bottleneck.
Premature optimization is the root of all evil, after all.
I shouldn't answer this, but I will anyway.

It is not always possible to optimize at the end of a project when bottlenecks are staring you in the face.  Projects have deadlines and need to ship.  Making sweeping changes to optimize areas invalidates all the QA work done to date.  Many optimizations are also incredibly dangerous to make and could easily introduce new problems.

Ah, but almost always (I'm saying 80% or so, some problems are inherently complex), most of the complexity that you see that makes changes difficult and dangerous later on, is due to premature optimisation!

The closer you follow the simplest solution, the easier it is to rewrite when performace starts to be an issue. And algorithmic rewrites are usually waaaaaay more performance enhancing than any language tweaks some hacker can come up with.

Robby