lua-users home
lua-l archive

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



Luiz Henrique de Figueiredo wrote:
I also did some other tests and found that foreach() is ~20% faster than the equivalent while loop, while foreachi() was ~20% slower than a while
loop.

You should compare this also with the "for" statement.

Yes, "for i, v in t do end" is about 5x as fast as a while.
Unfortunately, I'm stuck with Lua 3.2 and won't be able to make use of
"for" until toLua for Lua 4.x is available.

Steve