Skip to content

Instantly share code, notes, and snippets.

@aStonedPenguin
Last active February 29, 2016 08:36
Show Gist options
  • Save aStonedPenguin/af927d354eeec7bf1483 to your computer and use it in GitHub Desktop.
Save aStonedPenguin/af927d354eeec7bf1483 to your computer and use it in GitHub Desktop.
Loops comparison
require 'xbench' -- https://github.com/SuperiorServers/plib_v2/blob/master/lua/plib/libraries/xbench.lua
local t = {}
for i = 1, 128 do
t[i] = Entity(1)
end
xbench.Compare({
Pairs = function()
for k, v in pairs(t) do
end
end,
IPairs = function()
for k, v in ipairs(t) do
end
end,
ForLoop = function ()
for i = 1, #t do
end
end
}, 10000)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment