-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Checking out thousands of changes is slow for large repos #4591
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
Comments
Can you compare the time it takes lazygit to checkout the branch versus the time it takes on the command line, i.e. |
How can I measure the time of that command? |
Stopwatch? 😄 |
1.629 secs |
While hyperfine is a great benchmarking tool, it's no good in this case, because checking out the same branch again when it is already checked out is fast of course. You might just use But the result seems to be pretty close to what lazygit's log said (1.6s). Are you saying that the interaction in lazygit (from pressing space until you see the new branch in the commits panel) is significantly slower than that? |
what is slowing it down is the |
Ok, but there's not much we can do about that. Lazygit needs to make that call in order to find out what modified files to display. nixpkgs is a repo with a large number of files, and in such repos git status is simply slow. I bet calling You might experiment with things like |
I experience the same - and I don't think this was as slow as it is right now, still a few weeks back. Lazygit is essentially unusable for me with nixpkgs right now - every checkout or start of a rebase takes about 40 seconds via lazygit, but is instant (0,4 sec) from the command line.
This takes about 0.4 secs for me.
I did that, but it didn't make a difference. It seems like this is not implemented for linux, yet?
I have been happily using lazygit with nixpkgs for a long time, so there must be a way to do this. |
The 40s seemed to have been an outlier, maybe there was some fetch going on at the same or so. But I consistently get something between 5-10s. Some stuff from the logs:
The Still - entering a rebase or checking out a different branch freezes the UI for me for a few seconds. I noticed the "Local branches" view takes very long to load on initial startup. I assume that's related to the |
When I manually run it, I can make this very fast by removing the I tried removing a remote with ~900 branches, but that doesn't change it. I also tested in a fresh clone with only 1 local branch - that's instant. So this seems to be a function of the number of local branches, of which I currently have 43. Especially the fact that the UI freezes while fetching that information is annoying. Maybe updating the tracking information could be separated from updating the other parts and run async? |
Turns out the So, my takeaways for working with very big repos at the scale of nixpkgs:
I think it would still be good to not freeze on |
@Eveeifyeve note that you also have |
This is a great finding, something to watch out for. Thanks.
This is a well-known one; the default sort order setting was introduced in lazygit to increase performance, not because somebody liked it better. 😄 However, I'm surprised that setting Side note: I think we should change this back. We moved the setting from user config to state.yml for consistency with other settings, and because we decided this is the new way of persisting changes that you can change in the UI (like the branches sort order, or the "ignore whitespace" switch). However, that was before we had repo-local config files. Now that we have those, it would actually be better to move it back to a user config so that you can set the default to topo-order for the general case, and override it to default only for those few giant repos where it is needed for performance.
We already do this for the divergence-from-base-branch information (not shown by default, but you can enable it with For the blue arrows this is not a problem, because we only display them but never base any decisions on them. That's different for the yellow arrows: these are used for logic, e.g. to decide whether we need to prompt for force-pushing. It would be bad if we get this wrong because the values are stale. Hm, on the other hand, they can already be stale (with respect to what's actually on the remote) simply because you didn't fetch for a while, and we handle this case properly, so maybe it's fine to update them with a bit of delay. Anyway, I guess all I'm saying is that this is not a totally trivial change. |
Well, I had (this was the global config, not the repo local config)
Yes, that would be good. I'd think, those changed settings in the UI should not be persisted at all. I'd expect lazygit to start up with and respect whatever I have put in either the global or repo-local config. It's good to be able to temporarily change it, but the current situation, where I'd make a change to my global config file - without anything actually changing in practice, because there is a state that overrides it... is quite unintuitive.
A few thoughts:
|
We had long discussions about this, for example the one starting here. It was a deliberate decision to go with what we are doing now for diff context size, ignore whitespace, and branch sort order. That's not to say that it can't still be questioned again, of course. |
I filed a separate issue about this: #4602 |
Uh oh!
There was an error while loading. Please reload this page.
Describe the bug
A clear and concise description of what the bug is.
Checking out between branches is way to slow for large branches.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
A clear and concise description of what you expected to happen.
It should really not be as this slow.
Screenshots
If applicable, add screenshots to help explain your problem.
Version info:
commit=, build date=, build source=nix, version=0.50.0, os=darwin, arch=arm64, git version=2.49.0
2.49.0
Additional context
The text was updated successfully, but these errors were encountered: