Skip to content

REPLCompletions spends a lot of time on statx syscalls (when crawling filesystem) #53153

Closed
@topolarity

Description

@topolarity

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    REPLJulia's REPL (Read Eval Print Loop)filesystemUnderlying file system and functions that use it

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions