WohlSoft / SMBX-64-Compatibility

The configuration package for Moondust Project which is an implementation of SMBX-64 standard to provite the compatibility layer with the Legacy Engine (SMBX Engine v1.3)
2 stars 0 forks source link

Optimize loops in Lua scripts #2

Open Wohlstand opened 6 years ago

Wohlstand commented 6 years ago

In case of LuaJit to iterate through indexed tables is better for performance to use

for K,Blk in ipairs(bgos) do

instead of

for K,Blk in pairs(bgos) do

or:

for i=1, #bgos do

that on LuaJit has same performance, but fastest on pure Lua.