#791 add profiling for some operations (#1108)

This commit is contained in:
Alexander Courtis
2022-03-26 23:22:28 +11:00
committed by GitHub
parent 015234e032
commit 54c78dbca2
8 changed files with 46 additions and 5 deletions

View File

@@ -1,5 +1,6 @@
local a = vim.api
local log = require "nvim-tree.log"
local utils = require "nvim-tree.utils"
local core = require "nvim-tree.core"
@@ -28,6 +29,8 @@ function M.fn(name, with_open)
end
function M.force_dirchange(foldername, with_open)
local ps = log.profile_start("change dir %s", foldername)
if M.options.change_cwd and vim.tbl_isempty(vim.v.event) then
if M.options.global then
vim.cmd("cd " .. vim.fn.fnameescape(foldername))
@@ -41,6 +44,8 @@ function M.force_dirchange(foldername, with_open)
else
require("nvim-tree.renderer").draw()
end
log.profile_end(ps, "change dir %s", foldername)
end
function M.setup(options)

View File

@@ -1,3 +1,4 @@
local log = require "nvim-tree.log"
local uv = vim.loop
local view = require "nvim-tree.view"
local utils = require "nvim-tree.utils"
@@ -16,6 +17,7 @@ function M.fn(fname)
end
running[fname] = true
local ps = log.profile_start("find file %s", fname)
-- always match against the real path
local fname_real = uv.fs_realpath(fname)
if not fname_real then
@@ -68,6 +70,8 @@ function M.fn(fname)
view.set_cursor { index, 0 }
end
running[fname] = false
log.profile_end(ps, "find file %s", fname)
end
return M