lua-users home
lua-l archive

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


On 01/24/2018 09:49 PM, Egor Skriptunoff wrote:
> Just tested Lua from GutHub.
> [...]
> -- insert elements into some object
> local function insert(obj, elem1, elem2, ...)
> [...]
> Lua 5.3.4  Copyright (C) 1994-2017 Lua.org, PUC-Rio
>> dofile[[..\benchmark.lua]]
> 6.9270000000001
> [...]
> Lua 5.4.0  Copyright (C) 1994-2017 Lua.org, PUC-Rio
>> dofile[[..\benchmark.lua]]
> 21.887
> [...]
> -- Egor

In my code vararg functions not often [1]. And they have no
critical impact on performance. So (in my view) your benchmark
nicely exploits untypical case.

[1] History of style changes.

1. It looked ugly for me to write "for i = 1, select('#', ...)".
2. So I've started to write "arg = {...}" and for with ipairs().
3. And then it's occurred that more clear just to pass table instead
of sequence: "f(self, some, unknown, params)" vs
"f(self, some, {unknown, params})".

-- Martin