lua-users home
lua-l archive

Re: When is multiple assignment good style?

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


On 16 March 2017 at 16:49, Chris Jones <cmsj@tenshu.net> wrote:
> This always seems to be the argument, but is it actually valid?
>
> I just benchmarked table.insert vs a local alias, in a loop, with one
> million iterations, and the difference was 0.01s
sometimes it _is_ valid. In SnabbSwitch, once I found a single local
variable missing had a 6% impact in the number of packets processed
per second.
of course, that was a "true" local variable, not a module-level
upvalue, but it saved one table query on a second-level loop, so it
did matter.
-- 
Javier

AltStyle によって変換されたページ (->オリジナル) /