[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Poor man's benchmarking issue - help needed
- From: Michal Kottman <k0mpjut0r@...>
- Date: Wed, 31 Aug 2011 12:06:04 +0200
On 31 August 2011 11:44, HyperHacker <hyperhacker@gmail.com> wrote:
> 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?
Yes it does. Lua does not optimize everything. The VM is small and
fast enough, AFAIK it does not do any optimization.
It's up to you to take out the lookups out of the loop. Or use LuaJIT
- it is "smart enough to optimize that lookup out of a tight loop".
This StackOverflow question may provide some insight:
http://stackoverflow.com/questions/4643814/why-would-this-lua-optimization-hack-help/