joseluisq / gitnow

Speed up your Git workflow. :tropical_fish:
https://github.com/joseluisq/gitnow
MIT License
391 stars 25 forks source link

Slow startup #33

Closed petertriho closed 3 years ago

petertriho commented 3 years ago

source $__fish_data_dir/completions/git.fish in __gitnow_completions.fish seems to cause my start up to be really slow. After commenting out this line, it starts up just fine

joseluisq commented 3 years ago

What version are you using?

petertriho commented 3 years ago

fish v3.2.0 gitnow v2.8.0

I tried manually sourcing the git completion file and it also takes a while to load. I seem to get completion with git just fine without sourcing the file though so I'm not sure if it's necessary

joseluisq commented 3 years ago

Can you share please stats output of this simple test?

In my case this is a test on a Macos

$ fish -v
# fish, version 3.2.0
$  time fish -c "gitnow -v"
# GitNow version 2.8.0
# 
# ________________________________________________________
# Executed in  112.50 millis    fish           external
#   usr time   91.05 millis  179.00 micros   90.87 millis
#   sys time   21.20 millis  470.00 micros   20.73 milli
joseluisq commented 3 years ago

Also take a look to this thread https://github.com/joseluisq/gitnow/issues/23

petertriho commented 3 years ago
❯ fish -v
fish, version 3.2.0
❯ time fish -c "gitnow -v"
GitNow version 2.8.0

________________________________________________________
Executed in  583.12 millis    fish           external
   usr time  127.23 millis   93.00 micros  127.14 millis
   sys time   40.46 millis   93.00 micros   40.37 millis
petertriho commented 3 years ago

I believe my issue is different to #23, the slow start up is coming from sourcing the git completion file

petertriho commented 3 years ago
❯ time fish -c "gitnow -v"
GitNow version 2.8.0

________________________________________________________
Executed in  161.43 millis    fish           external
   usr time   28.20 millis  178.00 micros   28.02 millis
   sys time   38.84 millis    0.00 micros   38.84 millis

With source $__fish_data_dir/completions/git.fish in __gitnow_completions.fish removed

joseluisq commented 3 years ago
$ fish -v
# fish, version 3.2.0
$  time fish -c "gitnow -v"
# GitNow version 2.8.0
# 
# ________________________________________________________
# Executed in  112.50 millis    fish           external
#   usr time   91.05 millis  179.00 micros   90.87 millis
#   sys time   21.20 millis  470.00 micros   20.73 milli

But in my case this is with Git completions.

joseluisq commented 3 years ago

Just to confirm Can you share your CPU specs because the other user issue was because I couldn't reproduce his issue due to my CPU specs were higher than his one.

BTW source $__fish_data_dir/completions/git.fish is not faster but it should not be too slow than:

time fish -c "source $__fish_data_dir/completions/git.fish"

________________________________________________________
Executed in  158.19 millis    fish           external
   usr time  126.89 millis  150.00 micros  126.74 millis
   sys time   30.50 millis  371.00 micros   30.13 millis
petertriho commented 3 years ago

I have a Intel i7 8700k. This is through WSL2 so that could be the issue but I also have the same issue on a MBP15 2018

joseluisq commented 3 years ago

Well I can not say so much about using Fish via WSL2 but the slow issue is a bit weird and "probably" because your virtualization environment. Or Fish Git completions need some kind of optimization.

BTW I did the test above in a iMac Core i5 3,4 GHz and using the same fish 3.2.0

joseluisq commented 3 years ago

And this is a test in my Linux workstation (Intel Core i7 2.5GHz) but using Fish 3.1.2 with latest Gitnow.

$ fish -v
fish, version 3.1.2
$ time fish -c "gitnow -v"
GitNow version 2.8.0
________________________________________________________
Executed in   88,44 millis    fish           external 
   usr time   80,78 millis  1121,00 micros   79,66 millis 
   sys time   10,12 millis  219,00 micros    9,90 millis
joseluisq commented 3 years ago

BTW as I said the Fish Git completions are not "too fast" (https://github.com/joseluisq/gitnow/issues/23#issuecomment-703263514) but I should not compromise startup.

joseluisq commented 3 years ago

I got it!

Gitnow with completions

image

Gitnow without completions

gitnow-git-complisions-wsl-2

Yes, Gitnow, Git completions also Fish itself runs very slow in WSL2. So I will close the issue since there is nothing that Gitnow can do about it.

petertriho commented 3 years ago

@joseluisq would it be possible to add variables to skip the config and sourcing git completions? Something like GITNOW_SKIP_KEYBINDINGS and GITNOW_SKIP_GIT_COMPLETIONS. Possibly only sourcing the git completion file on demand?

joseluisq commented 3 years ago

It could be a new feature to opt-in that via the .gitnow file so I'm open to some PR for.