Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fish became slow because checking two tools #10503

Closed
Kodp opened this issue May 18, 2024 · 7 comments · Fixed by #10506
Closed

fish became slow because checking two tools #10503

Kodp opened this issue May 18, 2024 · 7 comments · Fixed by #10506
Labels
performance Purely performance-related enhancement without any changes in black box output
Milestone

Comments

@Kodp
Copy link

Kodp commented May 18, 2024

fish, version 3.7.1

execute

fish --profile /tmp/fish.prof -c fish_prompt
cat /tmp/fish.prof | sort -h

The last two rows:

114493  114493  -----> not command -sq fossil
358012  358012  -----> not command -sq hg

these two command takes a lot of time. I don't know why this is happening, it makes my fish slow down.

My environment is in wsl2.

@mqudsi
Copy link
Contributor

mqudsi commented May 18, 2024

What's your $PATH under WSL2? WSLv1 (and I think WSLv2, but I'm not sure) have an insanely long PATH by default.

@Kodp
Copy link
Author

Kodp commented May 19, 2024

Actually, I checked the path before, but I didn't think it was too long at the time because it can be that long under Windows; Then I compared it with another server and found that it was indeed quite long.... Thanks! Problem solved. But I still have a question. It seems that having a long PATH under Windows does not significantly slow down PowerShell or even when using oh-my-posh, does it?

@mqudsi
Copy link
Contributor

mqudsi commented May 19, 2024

Two different issues, first is that accessing Windows paths from WSL Linux binaries is slow because of how Microsoft implemented it, second is that normal pattern is to look up commands you expect to find, which means you can stop looking as soon as you find the first match. By contrast, if you have something like if not command -q foo and there's a good chance foo isn't found, you need to search each of those directories and not stop until you have exhausted them all.

#10506 attempts to work around this specific WSL issue.

@Kodp Kodp closed this as completed May 19, 2024
@Kodp Kodp reopened this May 19, 2024
@Kodp
Copy link
Author

Kodp commented May 19, 2024

Thank you for your very good answer

@Kodp Kodp closed this as completed May 19, 2024
@zanchey zanchey added this to the fish next-3.x milestone May 20, 2024
@zanchey zanchey added the performance Purely performance-related enhancement without any changes in black box output label May 20, 2024
@mqudsi
Copy link
Contributor

mqudsi commented May 20, 2024

For reference, this was closed by the combination of 3374692 (which is #10506) and 8c62f73 (which extended that to WSLv2).

@krobelus
Copy link
Member

do we want changelog entries for these fixes?

@mqudsi
Copy link
Contributor

mqudsi commented May 24, 2024

do we want changelog entries for these fixes?

Definitely for this one. I already tagged the PR with the release notes label.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance Purely performance-related enhancement without any changes in black box output
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants