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 to open (+45 seconds) #65

Closed
dfishburn opened this issue Feb 2, 2016 · 8 comments
Closed

Slow to open (+45 seconds) #65

dfishburn opened this issue Feb 2, 2016 · 8 comments

Comments

@dfishburn
Copy link

I am running on Windows, when executing shell commands with Vim, there is a little popup that shows up in the Windows taskbar. So if I run :grep or other such commands, this "cmd.exe" task will be present until the task completes.

When I open :Magit
I can see that cmd.exe window flashing over and over and over.

I would like to know a couple of things.

  1. What commands are actually being executed (is there any logging I can enable in Magit)?
  2. Why is it executing so many commands (I assume it is walking the directory tree and executing a command for every sub directory).
  3. I also assume q to close window #2 is actually running diff commands as well?

The reason I ask, is when I hit R (for refresh) in the Magit window this just took 45 seconds. Which is an absolute AGE. Yet, if I run :git status, I get essentially the same information in 1 second (minus the diffs).

Depending on your answer, here are some in advance.

If it is the diffs that are taking Magit so long to open, is it possible to turn those off by default and just show the modified files (just like git status). Then having a mapping which I use to ask Magit to fetch the diffs for the file (quite often these diffs are useful). If this could allow me to run :Magit in 2 seconds v 45 seconds it would make me user experience much much better.

David

@fpnick
Copy link

fpnick commented Feb 2, 2016

For me it also takes quite long under Linux, at least with our main (fairly big) repository.
This is sad, but I guess it's due to Vimagit's early development stage. Let's hope it gets better, soon ;)

@jreybert
Copy link
Owner

jreybert commented Feb 2, 2016

Hi @dfishburn

is there any logging I can enable in Magit

yes, you can enable a profiling function:
:call magit#utils#start_profile("path_to_profile_output")

is it possible to turn those off by default and just show the modified files

yes, you can try to set:
:let g:magit_default_show_all_files=0

Again, it is difficult to me to enhance experience with windows, as I don't work with such environment. Someday, I will install a virtual machine with Windows, when I'll find some time :)

Hi @fpnick , thanks for your report. There is an existing bug report about performance issues with Linux. If you mind, you may want to update it: #36. But you are right, performance is important, but reliability is more important IMO (I guess you don't want me to play evil with your git repo 😈 ). And if reproduce bug is dificult, reproduce performance issue is even harder!

@dfishburn
Copy link
Author

Thanks,

let g:magit_default_show_all_files=0

This changed the load time from 45 seconds to 4-7 seconds.
Once I have some changes to merge I will be able to validate what it is doing.

I will also give the logging a try and see where I get.

Thanks for the reply.
David

@jreybert
Copy link
Owner

jreybert commented Feb 2, 2016

Woot, 10x speed up 👏

Still, if you're OK to go deeper in analysis, I would need some git status output, see if play with lot of modified files, big changes in files, submodules and so on.

Anyway, thanks for your time.

@dfishburn
Copy link
Author

BTW, my time with 45 seconds down to 4-5 seconds, seems to be related to how many buffers I have open in Vim.

Since I restarted Vim, things are much faster and I have probably 10 files open instead of 100. Not sure if Magit is doing anything different / buffer? Can you let me know if I need to pursue that.

I tried the profiling:

:call magit#utils#start_profile("path_to_profile_output")

With an appropriate filename ("C:\temp\magit_profile1.txt").
And did the following:

Started Vim
:Magit
:bw!
:call magit#utils#start_profile("C:\temp\magit_profile1.txt")
:Magit
:q

Then tried to find that file. It was never written. According to :h :profile, the profile file should have been written when Vim was closed. Not sure why it wasn't written, but will pursue that again when I have more time.

Right now I am running with 39 buffers open (many are temporary from other plugins).
:Magit - 8 seconds
Refresh - 5 seconds

I of course still see it shelling out and running lots of commands.

@jreybert
Copy link
Owner

jreybert commented Feb 8, 2016

Since I restarted Vim, things are much faster and I have probably 10 files open instead of 100. Not sure if Magit is doing anything different / buffer? Can you let me know if I need to pursue that.

I don't see why a lot of opened files would slow down vimagit. There may be a weird side effect, but I don't have any lead about this.

Then tried to find that file. It was never written.

Yes, it should be written when you exit vim. Did you searched if there is a special behavior with windows?

I of course still see it shelling out and running lots of commands.

For each file present in git status output, I check if this file is:

  • a symlink
  • a submodule
  • a directory
  • an empty file
  • a binary file (should be fixed soon in windows)
  • or a regular modified file

Each entry may be visible or not (default behavior is set with g:magit_default_show_all_files): if an entry is visible, vimagit also get the diff content (git diff output for modified file, list of files for new directories, diff summary for modified submodule).

Most of these output need external commands. I did not know the behavior of "shelling out" on Windows. It could be interesting to find a comparison of typical execution overhead on Windows and Linux.

@jreybert
Copy link
Owner

jreybert commented Nov 2, 2016

Hi, what is the status with current master/next branch?

@jreybert
Copy link
Owner

I close this ticket as I can't reproduce the issue. Feel free to reopen it if you encounter the same problem.

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

3 participants