commit 14a5813c207716613daecf4ca9f69e3a3795596a
parent dcdefd042840c7a6db5dce2963ac23c45a5287da
Author: Lewis Russell <lewis6991@gmail.com>
Date: Wed, 15 May 2024 10:19:16 +0100
perf(vim.fs.normalize): use iterator
~10% faster.
Diffstat:
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git 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