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

Slow startup #5834

Closed
pat-s opened this issue Apr 20, 2019 · 2 comments
Closed

Slow startup #5834

pat-s opened this issue Apr 20, 2019 · 2 comments
Labels

Comments

@pat-s
Copy link

@pat-s pat-s commented Apr 20, 2019

Compared to bash which loads instantly, fish takes about 2-3s to start.

I am starting fish with an empty .config/fish/config.fish.

Doing fish -d 2 show that it spents a lot of time in /usr/share/fish/config.fish.
I tracked the problem down to the following part in /usr/share/fish/config.fish:

# Add a handler for when fish_user_path changes, so we can apply the same changes to PATH
function __fish_reconstruct_path -d "Update PATH when fish_user_paths changes" --on-variable fish_user_paths
set -l local_path $PATH
for x in $__fish_added_user_paths
set -l idx (contains --index -- $x $local_path)
and set -e local_path[$idx]
end
set -g __fish_added_user_paths
if set -q fish_user_paths
# Explicitly split on ":" because $fish_user_paths might not be a path variable,
# but $PATH definitely is.
for x in (string split ":" -- $fish_user_paths[-1..1])
if set -l idx (contains --index -- $x $local_path)
set -e local_path[$idx]
else
set -ga __fish_added_user_paths $x
end
set -p local_path $x
end
end
set -xg PATH $local_path
end

Commenting this part lets fish load instantly. I haven't played around enough to see whether commenting this has any bad consequences.

Does nobody else face this slow startup? I am wondering if it is related to my system only.

Details

fish, version 3.0.2
3.0.2

Terminal: st
OS: ArchLabs

uname -a
Linux tux 5.0.7-zen1-1-zen #1 ZEN SMP PREEMPT Mon Apr 8 10:36:23 UTC 2019 x86_64 GNU/Linux
@faho

This comment has been minimized.

Copy link
Member

@faho faho commented Apr 20, 2019

What this most likely means is that you have a massive $fish_user_paths. Solve that and it'll start up nice and snappy.

Do you have something like

set fish_user_paths $fish_user_paths /something

in your config.fish? Remove it, set -e fish_user_paths and set it once to the value you want via set -U fish_user_paths /whatever.

@faho faho added the question label Apr 20, 2019
@pat-s

This comment has been minimized.

Copy link
Author

@pat-s pat-s commented Apr 20, 2019

Indeed, it was related to fish_user_paths.
I had set -U already but no set -e before. Adding this solved the issue.

Thanks a lot for the quick reply, this was bugging me a lot!

@pat-s pat-s closed this Apr 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.