perf: cache handler groups

This commit is contained in:
Folke Lemaitre 2022-11-26 22:04:32 +01:00
parent 05a0da532b
commit 42c2fb42c8
No known key found for this signature in database
GPG key ID: 41F8B1FBACAE2040
3 changed files with 40 additions and 40 deletions

View file

@ -8,19 +8,13 @@ M.loading = {}
function M.setup()
local Handler = require("lazy.core.handler")
local groups = Handler.group(Config.plugins)
for t, handler in pairs(Handler.handlers) do
Util.track(t)
---@type LazyPlugin[]
local plugins = {}
for _, plugin in pairs(Config.plugins) do
if plugin[t] ~= nil then
table.insert(plugins, plugin)
end
if groups[t] then
Util.track(t)
handler(groups[t])
Util.track()
end
if #plugins > 0 then
handler(plugins)
end
Util.track()
end
end