tpope / vim-fugitive

fugitive.vim: A Git wrapper so awesome, it should be illegal
https://www.vim.org/scripts/script.php?script_id=2975
20.11k stars 1.01k forks source link

Git push freezes for 15 seconds #2263

Closed AntonC9018 closed 10 months ago

AntonC9018 commented 10 months ago

Simply doing :Git push freezes Neovim (version 0.9.5) for around 15 seconds. In the terminal the command itself takes 3 seconds. And even in general, any action (like calling :Git to pop open the window, s, cc, anything) is really sluggish (1-3 seconds delay). :Git! push does not seem to freeze the editor.

I'm using the qt version in order to not have to deal with keys remapping issues.

tpope commented 10 months ago

Let's start with a much simpler command: :Git rev-parse HEAD. How does that perform?

Compare to :!git rev-parse HEAD and :echo system(['git', 'rev-parse', 'HEAD']). Are those slow too?

(Closing until I have something actionable.)

AntonC9018 commented 10 months ago

So all of the other ones are instant, only :Git rev-parse HEAD is slow, and only in the Qt version. It's just fine in the terminal version. Forgot to mention I'm on Windows.

AntonC9018 commented 10 months ago

Here's some more info:

shellcmdflag=/s /c
shell=cmd.exe
AntonC9018 commented 10 months ago

@tpope I'm pinging you in case you didn't see the messages, since the issue is closed

tpope commented 10 months ago

@tpope I'm pinging you in case you didn't see the messages, since the issue is closed

It's been 24 hours. Chill.

Fugitive uses jobs; shell settings shouldn't be relevant. Here's two other commands you could try timing:

:echo jobwait([jobstart(['git', 'rev-parse', 'HEAD'])])
:echo FugitiveExecute(['rev-parse', 'HEAD'])

And here's two that start a job but don't wait on it to finish:

:echo jobstart(['git', 'rev-parse', 'HEAD'])
:echo FugitiveExecute(['rev-parse', 'HEAD'], function('len'))

Windows is inconvenient for me to test on, but I couldn't reproduce anything on the Linux version of neovim-qt.

AntonC9018 commented 10 months ago

It's been 24 hours. Chill.

I know, I'm not agitated or anything. Like I said, just in case.

I've ran all of the commands, all of them seem pretty much instant.

One thing to note that might be relevant: when running for example :Git, the mouse cursor (if visible) would constantly switch the sprite from a regular cursor to a spinner (the loading animation), what feels like every frame. Even :Git takes like a second and a half to pop up.

tpope commented 9 months ago

The status window uses little more than a few fugitive#Execute() calls. Whatever that mouse misbehavior is probably happens on a single fugitive#Execute(), however briefly. So maybe try looking closer for that.

tpope commented 9 months ago

Okay, I had a chance to try on an old Windows laptop, and I can't reproduce any slowness. Using Scriptease's :Time, :Git rev-parse @ is taking about 100ms, which is on par with GVim. For the status window on :Git, both Neovim-qt and GVim take about 150ms. (Note that running a git command reloads any open status window, so the time grows to 250ms total when running a command with it open.)

I should have said this before, but make sure you try with only Fugitive installed.

AntonC9018 commented 9 months ago

Okay, I had a chance to try on an old Windows laptop, and I can't reproduce any slowness. Using Scriptease's :Time, :Git rev-parse @ is taking about 100ms, which is on par with GVim. For the status window on :Git, both Neovim-qt and GVim take about 150ms. (Note that running a git command reloads any open status window, so the time grows to 250ms total when running a command with it open.)

I should have said this before, but make sure you try with only Fugitive installed.

I've tried running it with just fugitive enabled, it's still just as slow. It's taking more than a second for me.