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
Magit calls Git *many* times to produce the status buffer #1327
Comments
Except possibly on Windows, I think that the bad performance is mostly due to how inefficiently we parse diffs, and to a lesser extend parsing other things too. Also we use a lot of overlays but never disposed of them, making Magit slower over time. I have mostly addressed these issue on the Calling Git a lot certainly also isn't optimal but as I said and your benchmark seems to confirm it's probably not all that bad. I am not motivated to cache git output, and then to deal with cache invalidation. Actually I am hoping ffi will appear fairly soon in Emacs, since in the long run I want to use libgit2. For a long time I have not done anything about bad performance, at least not directly. That has changed recently, but most of that work is only in the One place where I have refactored mainly for performance is the wazzup buffer. The original implementation was deeply flawed and had terrible performance. Over the years you and others have added hacks to work around the bad performance, i.e. provide a way to filter out branches the user is not interested in. I have thrown all of that out and have instead made one small adjustment: Also note that the "delay inserting and/or washing" feature used by wazzup is currently hacked on top of the generic section handling. I am currently working on generalizing it so that it could be used elsewhere too, e.g. for initially-collapsed diffs in the status buffer. Related changes will including delaying the refinement of hunks and highlighting of bad whitespace. Together these things should give another big speedup. In short, there are still things left where we can get better performance by simply "doing the right thing" and so I want to concentrate on that and delay benchmark-motivated changes for a little longer. Not much longer though, the end of the refactoring is finally in sight. |
Sounds good! I look forward to seeing the |
By the way good benchmarks would help. It's not that nobody has ever provided any benchmarks that was capable of demonstrating that something was slow. But these benchmarks were never very "scientific", i.e. I got the impression that the benchmarks were run already knowing what the result would be. For example a good benchmark for refreshing the status buffer would not only show how long each git command is taking or how long each function on |
On |
Closing and adding to my "come back to this eventually" list. |
Here is a complete listing of all the Git commands Magit calls to generate its status buffer:
Note that several of these commands are repeated multiple times too.
I've created a patch to memoize the results of calls, so that the multiple calls are no longer done, but it only drops speed down from 1.22s to 1.06s in one of my repositories. Probably not worth the additional complexity.
The subject of this issue is:
magit-status
can be quite slow on large repositories, taking multiple seconds each time that I stage a hunk, which really slows down my workflow. I'd like to help make magit snappy for such use cases.The text was updated successfully, but these errors were encountered: