perf: new file-based cache that ensures rtp is alweays correct and will cache all files, including those after startup

This commit is contained in:
Folke Lemaitre 2023-02-12 20:35:27 +01:00
parent 0d3f2c4042
commit e115f5ec17
No known key found for this signature in database
GPG key ID: 41F8B1FBACAE2040
8 changed files with 275 additions and 513 deletions

View file

@ -680,25 +680,6 @@ function M:debug()
{ "not found", Cache.stats.find.not_found, "Number" },
}, { indent = 2 })
self:nl()
self:append("Cache.autoload()", "LazyH2"):nl()
self:props({
{ "total", Cache.stats.autoload.total, "Number" },
{ "time", self:ms(Cache.stats.autoload.time, 3), "Bold" },
{ "avg time", self:ms(Cache.stats.autoload.time / Cache.stats.autoload.total, 3), "Bold" },
}, { indent = 2 })
self:nl()
self:append("Cache", "LazyH2"):nl()
local Cache = require("lazy.core.cache")
Util.foreach(Cache.cache, function(modname, entry)
local kb = math.floor(#entry.chunk / 10.24) / 100
self:append("", "LazySpecial", { indent = 2 }):append(modname):append(" " .. kb .. "Kb", "Bold")
if entry.modpath ~= modname then
self:append(" " .. vim.fn.fnamemodify(entry.modpath, ":p:~:."), "LazyComment")
end
self:nl()
end)
end
return M