fix(perf): explorer was creating new table for each new entry
augment performance on large folder by a factor of 10. my /nix/store explorer goes from ~12sec to ~1.5sec.
This commit is contained in:
@@ -15,13 +15,13 @@ end
|
||||
|
||||
local function populate_children(handle, cwd, node, status)
|
||||
local node_ignored = node.git_status == "!!"
|
||||
local nodes_by_path = utils.bool_record(node.nodes, "absolute_path")
|
||||
while true do
|
||||
local name, t = uv.fs_scandir_next(handle)
|
||||
if not name then
|
||||
break
|
||||
end
|
||||
|
||||
local nodes_by_path = utils.key_by(node.nodes, "absolute_path")
|
||||
local abs = utils.path_join { cwd, name }
|
||||
t = get_type_from(t, abs)
|
||||
if
|
||||
@@ -42,6 +42,7 @@ local function populate_children(handle, cwd, node, status)
|
||||
end
|
||||
if child then
|
||||
table.insert(node.nodes, child)
|
||||
nodes_by_path[child.absolute_path] = true
|
||||
common.update_git_status(child, node_ignored, status)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user