Closed
Description
It was observed in #52765 that we generate a lot of statx
and readlink
syscalls when scanning the filesystem.
Especially on WSL systems this kind of access pattern can be very slow:
julia> @elapsed dir = readdir("/mnt/c/Windows/System32/")
0.048656877
julia> paths = ["/mnt/c/Windows/System32/" * name for name in dir];
julia> @elapsed for path in paths
isfile(path)
end
14.98347244 # ~300x slower than the 50 milliseconds spent above
The example above is not contrived. WSL by default appends /mnt/c/Windows/System32/
to my PATH so that when REPLCompletions walks the PATH, it has to do pretty much exactly the above.
Thankfully the getdents64
syscall on many modern Linux filesystems should allow getting file vs. directory information for lots of files in one go, so there should be a pathway to optimize this.