Page 1 of 1

"Localizing" functions and constants.

Posted: 06 Aug 2008, 13:00
by dizekat
I see a lot of widgets define local aliases for all the spring commands and constants that them use.

Did anyone ever benchmark properly if that makes anything faster?
Spring is using LUA JIT, aka "just in time compiler" (edit: or, at very least, compiles into VM), and i suppose compiler would look up all symbols only on first use anyway (no dictionary searches on consequent symbol uses), so that you gain precisely nothing from defining local names; only get slightly slower loading time and more obfuscation.
Speed advantage from defining local aliases seems really dubious and unlikely; and if it does give any advantage, i'd rather fix JIT compiler than obfuscate all the lua code i write.

Re: "Localizing" functions and constants.

Posted: 06 Aug 2008, 13:15
by Kloot
viewtopic.php?f=21&t=15748

Lua scripts are not JIT'ed.

Re: "Localizing" functions and constants.

Posted: 06 Aug 2008, 14:12
by dizekat
What was the problem using luajit in spring?
luajit features
looks good... is there any unsupported important lua features now?

Re: "Localizing" functions and constants.

Posted: 06 Aug 2008, 18:35
by very_bad_soldier
I find this quite interesting: http://trac.caspring.org/wiki/LuaPerformance