[PATCH] Wasted memory use storing path copies in node tree

When creating the node tree, every node stores a copy of its full path table. e.g. for node("admin.network.wireless"), node.path = { "admin", "network", "wireless" }

This value is not used anywhere, and likely may be from before the addition of the treecache lookup table? In any instance, I've searched high and low and see nothing ever referencing any node's path via the path member. It 
eats a good chunk of memory though and as such I believe it should be removed.

I've tested every page in the admin-full module after removing it and all seem to function properly.
This commit is contained in:
Jo-Philipp Wich 2011-08-12 11:04:42 +00:00
parent 69ba2e55a1
commit b3861e0ec7

View file

@ -612,28 +612,23 @@ function node(...)
return c
end
function _create_node(path, cache)
function _create_node(path)
if #path == 0 then
return context.tree
end
cache = cache or context.treecache
local name = table.concat(path, ".")
local c = cache[name]
local c = context.treecache[name]
if not c then
local new = {nodes={}, auto=true, path=util.clone(path)}
local last = table.remove(path)
local parent = _create_node(path)
c = _create_node(path, cache)
c.nodes[last] = new
cache[name] = new
return new
else
return c
c = {nodes={}, auto=true}
parent.nodes[last] = c
context.treecache[name] = c
end
return c
end
-- Subdispatchers --