perf: new file-based cache that ensures correct rtp order (#532)

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

* refactor: new cache

* test: fix tests

* fix(cache): cache file names on Windows

* feat(cache): allow to disable the cache

* docs: updated cache settings
This commit is contained in:
Folke Lemaitre 2023-02-13 12:01:56 +01:00 committed by GitHub
commit 462633bae1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 354 additions and 549 deletions

View file

@ -34,13 +34,16 @@ function M.setup(spec, opts)
local start = vim.loop.hrtime()
-- load module cache before anything else
require("lazy.core.cache").setup(opts)
if not (opts and opts.performance and opts.performance.cache and opts.performance.cache.enabled == false) then
require("lazy.core.cache").enable()
end
require("lazy.stats").track("LazyStart")
local Util = require("lazy.core.util")
local Config = require("lazy.core.config")
local Loader = require("lazy.core.loader")
table.insert(package.loaders, 3, Loader.loader)
Util.track({ plugin = "lazy.nvim" }) -- setup start
Util.track("module", vim.loop.hrtime() - start)