fix(#1961): harden profiling functions (#1986)

This commit is contained in:
Alexander Courtis
2023-02-11 17:05:01 +11:00
committed by GitHub
parent 02fdc262eb
commit b712b82b0c
11 changed files with 44 additions and 46 deletions

View File

@@ -41,7 +41,7 @@ function M.reload(node, git_status, unloaded_bufnr)
return
end
local ps = log.profile_start("reload %s", node.absolute_path)
local profile = log.profile_start("reload %s", node.absolute_path)
local filter_status = filters.prepare(git_status, unloaded_bufnr)
@@ -130,13 +130,13 @@ function M.reload(node, git_status, unloaded_bufnr)
node.group_next = child_folder_only
local ns = M.reload(child_folder_only, git_status)
node.nodes = ns or {}
log.profile_end(ps, "reload %s", node.absolute_path)
log.profile_end(profile)
return ns
end
sorters.merge_sort(node.nodes, sorters.node_comparator)
live_filter.apply_filter(node)
log.profile_end(ps, "reload %s", node.absolute_path)
log.profile_end(profile)
return node.nodes
end
@@ -164,8 +164,7 @@ function M.refresh_nodes_for_path(path)
return
end
local pn = string.format("refresh_nodes_for_path %s", path)
local ps = log.profile_start(pn)
local profile = log.profile_start("refresh_nodes_for_path %s", path)
NodeIterator.builder({ explorer })
:hidden()
@@ -186,7 +185,7 @@ function M.refresh_nodes_for_path(path)
end)
:iterate()
log.profile_end(ps, pn)
log.profile_end(profile)
end
function M.setup(opts)