chore: cleanup

This commit is contained in:
Folke Lemaitre 2022-11-23 16:10:16 +01:00
parent 2080694e34
commit 68a8d57b5b
No known key found for this signature in database
GPG Key ID: 41F8B1FBACAE2040
2 changed files with 5 additions and 7 deletions

View File

@ -11,23 +11,21 @@ function M.track(name, time)
if name then if name then
local entry = { local entry = {
name = name, name = name,
time = time or M.time(), time = time or vim.loop.hrtime(),
} }
table.insert(M._profiles[#M._profiles], entry) table.insert(M._profiles[#M._profiles], entry)
if not time then if not time then
table.insert(M._profiles, entry) table.insert(M._profiles, entry)
end end
return entry
else else
local entry = table.remove(M._profiles) local entry = table.remove(M._profiles)
entry.time = M.time() - entry.time entry.time = vim.loop.hrtime() - entry.time
return entry
end end
end end
function M.time()
return vim.loop.hrtime()
end
function M.file_exists(file) function M.file_exists(file)
return vim.loop.fs_stat(file) ~= nil return vim.loop.fs_stat(file) ~= nil
end end

View File

@ -34,7 +34,7 @@ function M.setup(opts)
Config.setup(opts) Config.setup(opts)
Util.track() Util.track()
Util.track("plugins") Util.track("state")
if Module.changed or not State.load() then if Module.changed or not State.load() then
-- rebuild state -- rebuild state
local Plugin = require("lazy.plugin") local Plugin = require("lazy.plugin")