mirror of https://github.com/folke/lazy.nvim.git
perf: added profiling for sourcing of runtime files
This commit is contained in:
parent
08d081f21d
commit
be509c01f9
|
@ -37,15 +37,16 @@ M.defaults = {
|
||||||
-- The border to use for the UI window. Accepts same border values as |nvim_open_win()|.
|
-- The border to use for the UI window. Accepts same border values as |nvim_open_win()|.
|
||||||
border = "none",
|
border = "none",
|
||||||
icons = {
|
icons = {
|
||||||
start = "",
|
cmd = " ",
|
||||||
init = " ",
|
|
||||||
plugin = " ",
|
|
||||||
source = " ",
|
|
||||||
config = "",
|
config = "",
|
||||||
event = "",
|
event = "",
|
||||||
keys = " ",
|
|
||||||
cmd = " ",
|
|
||||||
ft = " ",
|
ft = " ",
|
||||||
|
init = " ",
|
||||||
|
keys = " ",
|
||||||
|
plugin = " ",
|
||||||
|
runtime = " ",
|
||||||
|
source = " ",
|
||||||
|
start = "",
|
||||||
task = "✔ ",
|
task = "✔ ",
|
||||||
},
|
},
|
||||||
throttle = 20, -- how frequently should the ui process render events
|
throttle = 20, -- how frequently should the ui process render events
|
||||||
|
|
|
@ -134,7 +134,9 @@ function M.source_runtime(...)
|
||||||
Util.walk(dir, function(path, _, t)
|
Util.walk(dir, function(path, _, t)
|
||||||
local ext = path:sub(-3)
|
local ext = path:sub(-3)
|
||||||
if t == "file" and (ext == "lua" or ext == "vim") then
|
if t == "file" and (ext == "lua" or ext == "vim") then
|
||||||
|
Util.track({ runtime = path })
|
||||||
vim.cmd("silent source " .. path)
|
vim.cmd("silent source " .. path)
|
||||||
|
Util.track()
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
|
@ -16,6 +16,7 @@ M.colors = {
|
||||||
},
|
},
|
||||||
ProgressTodo = "LineNr",
|
ProgressTodo = "LineNr",
|
||||||
Special = "@punctuation.special",
|
Special = "@punctuation.special",
|
||||||
|
HandlerRuntime = "@macro",
|
||||||
HandlerPlugin = "Special",
|
HandlerPlugin = "Special",
|
||||||
HandlerEvent = "Constant",
|
HandlerEvent = "Constant",
|
||||||
HandlerKeys = "Statement",
|
HandlerKeys = "Statement",
|
||||||
|
|
|
@ -210,6 +210,11 @@ function M:reason(reason, opts)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
if reason.runtime then
|
||||||
|
reason.runtime = reason.runtime:gsub(".*/([^/]+/plugin/.*)", "%1")
|
||||||
|
reason.runtime = reason.runtime:gsub(".*/([^/]+/after/.*)", "%1")
|
||||||
|
reason.runtime = reason.runtime:gsub(".*/([^/]+/ftdetect/.*)", "%1")
|
||||||
|
end
|
||||||
local time = reason.time and (" " .. math.floor(reason.time / 1e6 * 100) / 100 .. "ms")
|
local time = reason.time and (" " .. math.floor(reason.time / 1e6 * 100) / 100 .. "ms")
|
||||||
if time and not opts.time_right then
|
if time and not opts.time_right then
|
||||||
self:append(time, "Bold")
|
self:append(time, "Bold")
|
||||||
|
|
Loading…
Reference in New Issue