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

Very slow on large repositories #2875

Closed
manorit2001 opened this issue Aug 4, 2023 · 14 comments
Closed

Very slow on large repositories #2875

manorit2001 opened this issue Aug 4, 2023 · 14 comments
Labels
bug Something isn't working

Comments

@manorit2001
Copy link

Describe the bug
I am trying to work in linux kernel and it has multiple remotes, I would agree that git also works a bit slow in it but lazygit takes a really long time to even work with it, is there any optimisation and disabling certain features that I can do that can help me still use lazygit for patch management but do a lazyfetch for a larger codebase to do certain things only when we require to and not
refresh the whole history after each and every operation that I perform?

Screenshots
image

Version info:

$ lazygit --version                                                                                                                                                              [15:40:12]
commit=f7bf12503701e6f402ae2ebfebed132feeda1bca, build date=2023-08-01T23:24:51Z, build source=unknown, version=f7bf1250, os=linux, arch=amd64, git version=2.41.0
$ git --version                                                                                                                                                                  [15:44:03]
git version 2.41.0
@manorit2001 manorit2001 added the bug Something isn't working label Aug 4, 2023
@manorit2001
Copy link
Author

Sorry for opening in the wrong section, I believe it should be a feature and not a bug

@stefanhaller
Copy link
Collaborator

stefanhaller commented Aug 4, 2023

Adding

git:
  log:
    order: default

to your config helps significantly.

@manorit2001
Copy link
Author

Is it possible to make the configs repository specific?

@mark2185
Copy link
Collaborator

mark2185 commented Aug 4, 2023

You could add it to the clone's .git/config?

EDIT: my bad, I misread, I thought Stefan suggested a gitconfig option.

@manorit2001
Copy link
Author

You could add it to the clone's .git/config?

That doesn't seem to be a yaml file that @stefanhaller answer corresponds to so am not sure if that'll be the right place, couldn't find anything in the docs related to it but am still searching if such a thing exists that could help me apply the configs for a particular repository

PS: I tried to apply the config globally btw but I still see around 30s-1m for lazygit to load and I still don't see the commits in the log being updated well enough after doing any changes.. I have disabled autoFetch also currently to further decrease the overhead but am not sure what else I could do, any other optimisations that can be done?

@stefanhaller
Copy link
Collaborator

Wow, that's bad. For me, it takes 12s to load without the config, and basically instantaneous with the config. Maybe you need to upgrade your hardware 😉? I'm on a 2021 MacBook Pro (M1), for reference.

There was also a recent PR with improvements to refresh times (#2841), you might try building from master and see if that makes a difference for you.

@stefanhaller
Copy link
Collaborator

Another thought: when was the last git gc done in your repo? This can also make a pretty big difference to git performance in general.

@manorit2001
Copy link
Author

Another thought: when was the last git gc done in your repo? This can also make a pretty big difference to git performance in general.

probably never, let me give that a try xD

@manorit2001
Copy link
Author

manorit2001 commented Aug 4, 2023

Another thought: when was the last git gc done in your repo? This can also make a pretty big difference to git performance in general.

probably never, let me give that a try xD

This made it faaar much better, thank you so much! I've migrated to latest master also but combined with all the output now the repo opens up in seconds only

@stefanhaller
Copy link
Collaborator

Glad to hear that. You probably want to type git maintenance start then to keep it tidy in the future. See here for more information.

@manorit2001
Copy link
Author

Thanks @stefanhaller , I'll enable it and look more for these git maintenance as this was really a cool thing for me!

Will be closing this issue as lazygit does seem to handle it if git is optimised enough

@manorit2001
Copy link
Author

Is it possible to make the configs repository specific?

Though that being said, this could be a good thing to implement not that I see the need currently but somehow might require it sometime maybe

@mwalkerr
Copy link

A few things that helped me:

git config core.fsmonitor true
git config core.untrackedcache true
  • Found out that lazygit was using git status --untracked-files=all --porcelain -z which was taking a lot longer than git status --porcelain -z ( --untracked-files=all removed) despite all apparently being the default option for --untracked-files. Not sure why that is but because this command isn't configurable in lazygit I'm using a proxy command for git that just removes the --untracked-files=all arg:
#!/bin/bash

# Initialize an empty array to hold the arguments for git command
filtered_args=()

# Loop through all passed arguments
for arg in "$@"; do
  # Check if the argument is '--untracked-files=all'
  if [ "$arg" = "--untracked-files=all" ]; then
    # If it is, skip adding it to the filtered_args array
    continue
  fi
  # If it isn't, add the argument to the filtered_args array
  filtered_args+=("$arg")
done

# Execute /usr/bin/git with the filtered arguments
/usr/local/bin/git "${filtered_args[@]}"

@phanirithvij
Copy link

gitui has fetches commits in batches in background can lazygit do that? is there a github issue already discussing this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants