meta data for this page
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
programming:lua:optimisation [2019/09/26 10:53] niziak created |
programming:lua:optimisation [2020/07/03 09:48] (current) niziak ↷ Page moved from lua:optimisation to programming:lua:optimisation |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | [[https://www.lua.org/gems/sample.pdf|Lua Performance Tips]] | ||
+ | [[https://stackoverflow.com/questions/154672/what-can-i-do-to-increase-the-performance-of-a-lua-program|What can I do to increase the performance of a Lua program?]] | ||
+ | |||
====== Avoid globals ====== | ====== Avoid globals ====== | ||
Local variables are very fast as they reside in virtual machine registers, and are accessed directly by index. Global variables on the other hand, reside in a lua table and as such are accessed by a hash lookup." -- Thomas Jefferson | Local variables are very fast as they reside in virtual machine registers, and are accessed directly by index. Global variables on the other hand, reside in a lua table and as such are accessed by a hash lookup." -- Thomas Jefferson | ||
Line 4: | Line 7: | ||
<code lua> | <code lua> | ||
local find = string.find | local find = string.find | ||
+ | local sin = math.sin | ||
</code> | </code> | ||