diff options
author | Lewis Russell <lewis6991@gmail.com> | 2024-05-14 17:29:28 +0100 |
---|---|---|
committer | Lewis Russell <me@lewisr.dev> | 2024-05-15 12:38:26 +0100 |
commit | dcdefd042840c7a6db5dce2963ac23c45a5287da (patch) | |
tree | 334b021fa547da0ace5c6bef188accf626966092 /runtime/lua/vim/loader.lua | |
parent | 87a45ad9b98e2e69c36091d397ad5b70a688b23f (diff) | |
download | rneovim-dcdefd042840c7a6db5dce2963ac23c45a5287da.tar.gz rneovim-dcdefd042840c7a6db5dce2963ac23c45a5287da.tar.bz2 rneovim-dcdefd042840c7a6db5dce2963ac23c45a5287da.zip |
perf(loader): use a quicker version of vim.fs.normalize
Problem:
vim.fs.normalize() normalizes too much vim.loader and is slow.
Solution:
Make it faster by doing less. This reduces the times spent in
vim.fs.normalize in vim.loader from ~13ms -> 1-2ms.
Numbers from a relative benchmark:
- Skipping `vim.validate()`: 285ms -> 230ms
- Skipping `path_resolve_dot()`: 285ms -> 60ms
- Skipping `double_slash`: 60ms -> 35ms
Diffstat (limited to 'runtime/lua/vim/loader.lua')
-rw-r--r-- | runtime/lua/vim/loader.lua | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/runtime/lua/vim/loader.lua b/runtime/lua/vim/loader.lua index d3d8948654..ea77a22416 100644 --- a/runtime/lua/vim/loader.lua +++ b/runtime/lua/vim/loader.lua @@ -85,7 +85,7 @@ function Loader.get_hash(path) end local function normalize(path) - return fs.normalize(path, { expand_env = false }) + return fs.normalize(path, { expand_env = false, _fast = true }) end --- Gets the rtp excluding after directories. |