diff options
author | Lewis Russell <lewis6991@gmail.com> | 2024-05-15 10:19:16 +0100 |
---|---|---|
committer | Lewis Russell <me@lewisr.dev> | 2024-05-15 12:38:26 +0100 |
commit | 14a5813c207716613daecf4ca9f69e3a3795596a (patch) | |
tree | 68a67bdacf23411787777107f766b5d942b6e3c4 /runtime/lua/vim/fs.lua | |
parent | dcdefd042840c7a6db5dce2963ac23c45a5287da (diff) | |
download | rneovim-14a5813c207716613daecf4ca9f69e3a3795596a.tar.gz rneovim-14a5813c207716613daecf4ca9f69e3a3795596a.tar.bz2 rneovim-14a5813c207716613daecf4ca9f69e3a3795596a.zip |
perf(vim.fs.normalize): use iterator
~10% faster.
Diffstat (limited to 'runtime/lua/vim/fs.lua')
-rw-r--r-- | runtime/lua/vim/fs.lua | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/runtime/lua/vim/fs.lua b/runtime/lua/vim/fs.lua index 58e79db0b4..ce533ad0a9 100644 --- a/runtime/lua/vim/fs.lua +++ b/runtime/lua/vim/fs.lua @@ -455,11 +455,9 @@ end --- @return string Resolved path. local function path_resolve_dot(path) local is_path_absolute = vim.startswith(path, '/') - -- Split the path into components and process them - local path_components = vim.split(path, '/') local new_path_components = {} - for _, component in ipairs(path_components) do + for component in vim.gsplit(path, '/') do if component == '.' or component == '' then -- luacheck: ignore 542 -- Skip `.` components and empty components elseif component == '..' then |