lua-users home
lua-l archive

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


On Wed, Aug 31, 2011 at 13:44, HyperHacker <hyperhacker@gmail.com> wrote:
> On Wed, Aug 31, 2011 at 03:35, steve donovan <steve.j.donovan@gmail.com> wrote:
>> On Wed, Aug 31, 2011 at 11:32 AM, TNHarris <telliamed@whoopdedo.org> wrote:
>>> Partly because you're measuring table lookups. Alias math.floor and math.ceil to locals and the times I get go from 40% slower to just 25% slower.

>> That's the kind of thing that experienced people know and everyone
>> else needs to know, i.e. should go in the uFAQ under optimization
>> tips.

> Does math.ceil(x) in a loop seriously look up 'ceil' (and maybe even
> 'math') every time it's called? It's not smart enough to optimize that
> lookup out of a tight loop if nothing is changing it?

Of course not! That what LuaJIT2 is for! :-)

Plain Lua does not do (almost) any optimizations.

Alexander.