Re: Parsing varargs to a function
"'Martin Eden' via lua-l" <[email protected]> Tue, 28 Apr 2026 01:02:15 +0200
| Newsgroups | gmane.comp.lang.lua.general |
|---|---|
| Message-ID | <[email protected]> |
On 2026-04-27 22:57, Lars Müller wrote: > Personally I would have preferred a (peephole-ish) optimization that makes > "x = select(i, ...)" constant time, as found in LuaJIT. > Then the "select"-loop would be fine as idiomatic vararg iteration > construct. > (In its current state, it runs in quadratic time on PUC Lua, as varargs > with (average) linear length are copied on the stack in every invocation. > For older versions of PUC Lua, I thus recommend iterating tables by first > packing them up using table.pack and then iterating up to t.n instead.) Hello Lars, I don't care about performance of PacMan's bait "...". I use "..." mostly to wrap results of function passed as argument. So there is unlikely be 20 M values from function. And O(N) get_by_index(index, ...) is okay. -- Martin -- You received this message because you are subscribed to the Google Groups "lua-l" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion visit https://groups.google.com/d/msgid/lua-l/5e68c2c2-aa8d-4f01-b67b-65d8332b3246%40disroot.org.