lua-users home
lua-l archive

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


On Tue, Dec 18, 2012 at 12:53 PM, Dirk Laurie <dirk.laurie@gmail.com> wrote:
> Do you say that on principle or do you have timings?

I think the timings show this.

(1) is varargs sum with select, (2) is varargs sum with {...} (3) is
sum with explicit array to measure indexing

Times are seconds (time for a million calls)
Lua 5.1
1)  0.83
2) 0.88
3) 0.36

(3) is (2) without {...}, so there's about 0.5 seconds worth of table
construction going on..

For Lua 5.2, (1) drops to 0.75 and (2) is 0.87; (3) is unchanged.

For LuaJIT,
1) 0.14
2) 0.34
3) 0.06

select() is starting to feel like a winner in this case...

steve d.