lua-users home
lua-l archive

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


On 20/12/2012, at 6:56 AM, steve donovan <steve.j.donovan@gmail.com> wrote:

> e.g. use numerical for instead of for/ipairs


Do you have any data to back up this widely believed fact?

Try this test [1], or your own, better, test.

As far as I can tell, if you're using PUC Lua, then yes, a numeric for is faster than ipairs, but a while loop is even better.  If you care about performance, you're probably using LuaJIT, and the loop structure doesn't make any difference.

Cheers,
Geoff

[1] https://gist.github.com/2927017