Skip to content
Snippets Groups Projects
Commit 350aa821 authored by DarkGod's avatar DarkGod
Browse files

Merge branch 'upvalue_slowdown' into 'master'

Upvalue slowdown

That seems to improve loading times by roughly 5 seconds on my toaster.
parents dd6631f9 021c8842
No related branches found
No related tags found
No related merge requests found
......@@ -96,6 +96,21 @@ function _M:init(t, no_default)
end
end
if config.settings.cheat and not self._no_upvalues_check then
local ok, err = table.check(
self,
function(t, where, v, tv)
if tv ~= "function" then return true end
local n, v = debug.getupvalue(v, 1)
if not n then return true end
return nil, ("%s has upvalue %s"):format(tostring(where), tostring(n))
end,
function(value) return not value._allow_upvalues end)
if not ok then
error("Entity definition has a closure: "..err)
end
end
if self.color then
self.color_r = self.color.r
self.color_g = self.color.g
......@@ -141,20 +156,6 @@ function _M:init(t, no_default)
end
end
if config.settings.cheat and not self._no_upvalues_check then
local ok, err = table.check(
self,
function(t, where, v, tv)
if tv ~= "function" then return true end
local n, v = debug.getupvalue(v, 1)
if not n then return true end
return nil, ("%s has upvalue %s"):format(tostring(where), tostring(n))
end,
function(value) return not value._allow_upvalues end)
if not ok then
error("Entity definition has a closure: "..err)
end
end
end
--- If we are cloned we need a new uid
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment