projects
/
project
/
luci.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[PATCH] Wasted memory use storing path copies in node tree
[project/luci.git]
/
libs
/
web
/
luasrc
/
dispatcher.lua
diff --git
a/libs/web/luasrc/dispatcher.lua
b/libs/web/luasrc/dispatcher.lua
index e29bd52bc8e240c70c9566332c43e0b40fcb82f8..0162407cd54bc3d936d2002f80bf0b2009417756 100644
(file)
--- a/
libs/web/luasrc/dispatcher.lua
+++ b/
libs/web/luasrc/dispatcher.lua
@@
-612,28
+612,23
@@
function node(...)
return c
end
return c
end
-function _create_node(path
, cache
)
+function _create_node(path)
if #path == 0 then
return context.tree
end
if #path == 0 then
return context.tree
end
- cache = cache or context.treecache
local name = table.concat(path, ".")
local name = table.concat(path, ".")
- local c = cache[name]
+ local c = c
ontext.treec
ache[name]
if not c then
if not c then
- local new = {nodes={}, auto=true, path=util.clone(path)}
local last = table.remove(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
end
+ return c
end
-- Subdispatchers --
end
-- Subdispatchers --