Example: air traffic controller
Lua Performance Tips

Lua Performance Tips

Back to document page

x = x + math.sin(i) end return x end print(foo(10)) We can optimize it by declaring sin once, outside function foo : local sin = math.sin function foo (x) for i = 1, 1000000 do x = x + sin(i) end return x end print(foo(10)) This second code runs 30% faster than the original one. Although the Lua compiler is quite efc ient when compared wi th ...

  Performance, Tips, Math, Lua performance tips

Download Lua Performance Tips


Information

Domain:

Source:

Link to this page:

Please notify us if you found a problem with this document:

Other abuse

Advertisement

Related search queries