mirror of
https://github.com/neovim/neovim
synced 2025-07-17 01:31:48 +00:00
perf(vim.fs.normalize): use iterator
~10% faster.
This commit is contained in:
committed by
Lewis Russell
parent
dcdefd0428
commit
14a5813c20
@ -455,11 +455,9 @@ end
|
|||||||
--- @return string Resolved path.
|
--- @return string Resolved path.
|
||||||
local function path_resolve_dot(path)
|
local function path_resolve_dot(path)
|
||||||
local is_path_absolute = vim.startswith(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 = {}
|
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
|
if component == '.' or component == '' then -- luacheck: ignore 542
|
||||||
-- Skip `.` components and empty components
|
-- Skip `.` components and empty components
|
||||||
elseif component == '..' then
|
elseif component == '..' then
|
||||||
|
Reference in New Issue
Block a user