Originally Posted by Rilgamon
Turn your logic around a little. The request was to improve the performance. And removing select will always be an improvement.
|
Sure, but I didn't read the word "performance" anywhere, only "better". If the performance gain is negligible I would definitely go for readability.
Edit: Without wanting to make a point of it, just did some quick benchmarks so people can get an idea of the difference.
This takes 43 ms to run:
Code:
for i = 1, 1e6 do
local a, b, c = 1, 2, 3, 4, 5, 6, 7, 8, 9
end
This takes 94 ms to run, with the first
select argument not affecting the result. No local reference.
Code:
for i = 1, 1e6 do
local a, b, c = select(1, 1, 2, 3, 4, 5, 6, 7, 8, 9)
end
That's one million iterations, with each value adding a few ms in both tests.