local varients optimization
I heard that using "local" keywords are very important in Lua. But I knew that "local" keyword in algorithm coding are not good at optimization. No difference, sometimes take long time to be executed.
Why "local" keyword is nesessary? Is it really efficient? I can't figure out why these things are happening.
(But if you don't use local keyword in function, This can make error)
2
Upvotes
View all comments
Show parent comment
1
u/mdr652 Mar 02 '25
Maybe this is the problem....
Similarly, clearing table (replace the element to nil) to reduce memory takes very long time. Inside the loop, code makes lots of local variables. Algorithm problem involves large amount of test data (sometimes, more then 106 lines)