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

vimagit can be very slow #170

Closed
mg979 opened this issue Sep 5, 2018 · 9 comments
Closed

vimagit can be very slow #170

mg979 opened this issue Sep 5, 2018 · 9 comments

Comments

@mg979
Copy link

mg979 commented Sep 5, 2018

Short description of the problem

vimagit buffer update can take ages. It usually happens when there are a lot of changes. My guess is that it has to do with folding, because if I abort with <C-c> while the process is stuck, close the buffer and reopen vimagit, hunks are staged/unstaged correctly. Maybe vimagit updates the buffer while folding is active, bit by bit? In this case a possible solution would be to disable folding while updating buffer, or similar.

Steps to reproduce

The more text, the slower it is. It's not dependent on the number of hunks, but on how big hunks are.

Environment

Linux Debian stable.

  • vim or nvim version: vim 8.0+ (sometimes 8.1)

  • git version: 2.11

  • current vimagit version or (or SHA1): 85c25ff

  • terminal or gvim: terminal

@mg979 mg979 changed the title vimagit cna be very slow vimagit can be very slow Sep 5, 2018
@jreybert
Copy link
Owner

jreybert commented Oct 8, 2018

Thanks for your report, this is a lead I never explored.
I'll dig around it and update this ticket if I find anything relevant.

@mg979
Copy link
Author

mg979 commented Oct 8, 2018

Maybe it has also to do with certain filetypes, because usually it's fast. It behaved worst with dos files with very long lines and lots of tabs (a sort of table).

@jreybert
Copy link
Owner

jreybert commented Oct 9, 2018

As you mention very long lines, it reminds me that vim by itself can be very slow with long lines, because of syntax coloring.

@jreybert
Copy link
Owner

jreybert commented Oct 9, 2018

By any chance, would you have a public repository which makes vimagit slow?

Could you also test with this following setting in your vimrc:
let g:magit_default_fold_level = 2

@mg979
Copy link
Author

mg979 commented Oct 9, 2018

You could try with this commit, make a branch out of it, then git reset --hard HEAD^ and squash the original branch without committing, so that you can have the unstaged commit in vimagit.

The README.md file takes a lot to be staged/unstaged, but hit <c-c>, quit vimagit, and enter again, you'll see that the operation is done, and vimagit loads fast as usual.

Edit: let g:magit_default_fold_level = 2 doesn't help.

@jreybert
Copy link
Owner

jreybert commented Oct 9, 2018

Excellent, thanks a lot for your input!

jreybert added a commit that referenced this issue Oct 12, 2018
On first refresh, vimagit can be stuck during several seconds.
foldmethod=syntax seems to be the culprit.

Longer explanation:

Remove folding while we are updating the buffer. writing to the buffer
while the folding is enabled can be veryyyyy slow.
One last strange thing is that, the first time the buffer is written, it
is not slow at all. It is slow the second time, at first refresh (can be
order of seconds). Then at third time (2nd refresh), it is fast again.
@jreybert
Copy link
Owner

Hourray! It has been fixed!

Thanks a lot for all your input, it wouldn't have been possible without that.

Could you try the branch next?

@mg979
Copy link
Author

mg979 commented Oct 12, 2018

Thanks, I'll be able to test it in a few days because I have only Windows in this machine and gvim there doesn't seem to have this problem (even if it's slow on its own because command line stuff seems to much slower on Windows anyway), but I'm confident it will work :)

@mg979
Copy link
Author

mg979 commented Oct 17, 2018

Ok I tested it and it seems perfect to me, much more responsive, thanks!

@mg979 mg979 closed this as completed Oct 17, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants