1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

ある日突然 fish が激重になった → asdf を brew で入れてるせいだったパターン

Last updated at Posted at 2020-07-06

結論

asdf を brew 経由でいれていて

~/.config/fish/config.fish に以下を書いていたのが原因。

source (brew --prefix asdf)/asdf.fish

で、これに1秒以上かかってました!!

$ time brew --prefix asdf
/usr/local/opt/asdf

________________________________________________________
Executed in    1.35 secs   fish           external
   usr time  489.69 millis  106.00 micros  489.59 millis
   sys time  313.33 millis  467.00 micros  312.86 millis

なので、以下のようにパスをベタガキして人権を取り戻しました。

source /usr/local/opt/asdf/asdf.fish

感想

brew で入れないで素直に git とかでいれておけばこんなことにはならなかった。のかもしれないけど、fish のプロファイリングの勉強になったので、逆によかった!

調べ方

$ fish --profile /tmp/fish.prof -c 'complete -C"fis"'

$ sort -nk2 /tmp/fish.prof | tail -n 20
665	789	------> source /usr/local/Cellar/fish/3.1.2/share/fish/functions/seq.fish
124	817	---> for x in (string split ":" -- $fish_user_paths[-1..1])
7	841	--> if set -q fish_user_paths
842	864	--> source /usr/local/Cellar/fish/3.1.2/share/fish/functions/__fish_set_locale.fish
49	1030	-> __fish_reconstruct_path
286	1361	-> __fish_set_locale
5481	5515	---> dirname (status -f)
105	5620	--> set -x ASDF_DIR (dirname (status -f))
5615	5663	-----> seq 1 (count $PATH)
122	6099	----> for i in (seq 1 (count $PATH))
8	6136	---> if test -d $x
5320	6203	-----> seq 1 (count $PATH)
1584	6296	> builtin source /usr/local/Cellar/fish/3.1.2/share/fish/config.fish
107	6551	----> for i in (seq 1 (count $PATH))
8	6596	---> if test -d $x
38	12975	--> for x in $asdf_bin_dirs
18305	18305	> complete -C"fis"
1251826	1251826	--> brew --prefix asdf
602	1271876	-> source (brew --prefix asdf)/asdf.fish
359	1272262	> builtin source /Users/mochizuki/.config/fish/config.fish

参考: https://github.com/fish-shell/fish-shell/issues/6611

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?