Skip to content

__fish_complete_directories is slow on WSL2 #9574

Description

@eero-lehtinen
❯ fish --version
fish, version 3.6.0

❯ uname -a
Linux EeroPC 5.15.83.1-microsoft-standard-WSL2 #1 SMP Wed Dec 14 23:16:32 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

The fish command __fish_complete_directories is slow compared to __fish_complete_cd on WSL2.

~/test
❯ set CDPATH ./

~/test
❯ time __fish_complete_cd
./test1/        CDPATH ./
./test2/        CDPATH ./

________________________________________________________
Executed in  858.00 micros    fish           external
   usr time   89.00 micros   89.00 micros    0.00 micros
   sys time  750.00 micros  750.00 micros    0.00 micros


~/test
❯ time __fish_complete_directories
test1/  Directory
test2/  Directory

________________________________________________________
Executed in  139.07 millis    fish           external
   usr time    2.57 millis    2.57 millis    0.00 micros
   sys time   21.88 millis   21.88 millis    0.00 micros

This seems to be because fish searches the whole path for commands thanks to of this hack https://github.com/fish-shell/fish-shell/blob/904839dccee9aad844889b57c2c56a818cde9905/share/functions/__fish_complete_directories.fish#LL18. On WSL2, $PATH includes a lot of mounted windows paths that are slow to search, e.g. /mnt/c/WINDOWS/system32.

We really should find a solution for this hack to make __fish_complete_directories acceptably fast on WSL2. I am running into this problem because zoxide uses this command. It makes completions annoyingly slow on fish while other shells don't have any issues.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions