fix(#549): add more profiling ~tree init
This commit is contained in:
@@ -2,6 +2,7 @@ local events = require "nvim-tree.events"
|
|||||||
local explorer = require "nvim-tree.explorer"
|
local explorer = require "nvim-tree.explorer"
|
||||||
local live_filter = require "nvim-tree.live-filter"
|
local live_filter = require "nvim-tree.live-filter"
|
||||||
local view = require "nvim-tree.view"
|
local view = require "nvim-tree.view"
|
||||||
|
local log = require "nvim-tree.log"
|
||||||
|
|
||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
@@ -9,6 +10,9 @@ TreeExplorer = nil
|
|||||||
local first_init_done = false
|
local first_init_done = false
|
||||||
|
|
||||||
function M.init(foldername)
|
function M.init(foldername)
|
||||||
|
local pn = string.format("core init %s", foldername)
|
||||||
|
local ps = log.profile_start(pn)
|
||||||
|
|
||||||
if TreeExplorer then
|
if TreeExplorer then
|
||||||
TreeExplorer:destroy()
|
TreeExplorer:destroy()
|
||||||
end
|
end
|
||||||
@@ -17,6 +21,7 @@ function M.init(foldername)
|
|||||||
events._dispatch_ready()
|
events._dispatch_ready()
|
||||||
first_init_done = true
|
first_init_done = true
|
||||||
end
|
end
|
||||||
|
log.profile_end(ps, pn)
|
||||||
end
|
end
|
||||||
|
|
||||||
function M.get_explorer()
|
function M.get_explorer()
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ local sorters = require "nvim-tree.explorer.sorters"
|
|||||||
local filters = require "nvim-tree.explorer.filters"
|
local filters = require "nvim-tree.explorer.filters"
|
||||||
local live_filter = require "nvim-tree.live-filter"
|
local live_filter = require "nvim-tree.live-filter"
|
||||||
local notify = require "nvim-tree.notify"
|
local notify = require "nvim-tree.notify"
|
||||||
|
local log = require "nvim-tree.log"
|
||||||
|
|
||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
@@ -61,6 +62,9 @@ function M.explore(node, status)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local pn = string.format("explore init %s", node.absolute_path)
|
||||||
|
local ps = log.profile_start(pn)
|
||||||
|
|
||||||
populate_children(handle, cwd, node, status)
|
populate_children(handle, cwd, node, status)
|
||||||
|
|
||||||
local is_root = not node.parent
|
local is_root = not node.parent
|
||||||
@@ -69,11 +73,15 @@ function M.explore(node, status)
|
|||||||
node.group_next = child_folder_only
|
node.group_next = child_folder_only
|
||||||
local ns = M.explore(child_folder_only, status)
|
local ns = M.explore(child_folder_only, status)
|
||||||
node.nodes = ns or {}
|
node.nodes = ns or {}
|
||||||
|
|
||||||
|
log.profile_end(ps, pn)
|
||||||
return ns
|
return ns
|
||||||
end
|
end
|
||||||
|
|
||||||
sorters.merge_sort(node.nodes, sorters.node_comparator)
|
sorters.merge_sort(node.nodes, sorters.node_comparator)
|
||||||
live_filter.apply_filter(node)
|
live_filter.apply_filter(node)
|
||||||
|
|
||||||
|
log.profile_end(ps, pn)
|
||||||
return node.nodes
|
return node.nodes
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ local M = {}
|
|||||||
|
|
||||||
local events = require "nvim-tree.events"
|
local events = require "nvim-tree.events"
|
||||||
local utils = require "nvim-tree.utils"
|
local utils = require "nvim-tree.utils"
|
||||||
|
local log = require "nvim-tree.log"
|
||||||
|
|
||||||
local function get_win_sep_hl()
|
local function get_win_sep_hl()
|
||||||
-- #1221 WinSeparator not present in nvim 0.6.1 and some builds of 0.7.0
|
-- #1221 WinSeparator not present in nvim 0.6.1 and some builds of 0.7.0
|
||||||
@@ -231,6 +232,9 @@ function M.open(options)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local pn = string.format "view open"
|
||||||
|
local ps = log.profile_start(pn)
|
||||||
|
|
||||||
create_buffer()
|
create_buffer()
|
||||||
open_window()
|
open_window()
|
||||||
M.resize()
|
M.resize()
|
||||||
@@ -240,6 +244,8 @@ function M.open(options)
|
|||||||
vim.cmd "wincmd p"
|
vim.cmd "wincmd p"
|
||||||
end
|
end
|
||||||
events._dispatch_on_tree_open()
|
events._dispatch_on_tree_open()
|
||||||
|
|
||||||
|
log.profile_end(ps, pn)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function grow()
|
local function grow()
|
||||||
|
|||||||
Reference in New Issue
Block a user