lazygit icon indicating copy to clipboard operation
lazygit copied to clipboard

Degraded performance when running lazygit with TERM=vte-direct

Open aureq opened this issue 3 years ago • 4 comments

Describe the bug When running lazygit from the fish shell, lazygit takes longer than usual to load, display the commit history and operations are sluggish as well. The problem doesn't manifest when I run lazygit from bash.

To Reproduce Steps to reproduce the behavior:

  1. open a terminal and set your TERM=vte-direct
  2. Go to a clone git repository
  3. run lazygit
  4. lazygit starts but it takes a few seconds for the interface to appears and few more seconds for the commit history to appear.
  5. Other operations are slow such as resizing the terminal

Expected behavior lazygit should be fast as usual

Version info: lazygit: version 0.35 git version 2.30.2 debian 11 (up to date)

Additional notes 1 - I compiled the master branch and installed the binary, but the problem remains. 2 - Maybe, it's conflict between TERM and COLORTERM (COLORTERM=truecolor).

Using --debug and --logs, there's no obvious error messages, however, it takes a good 5 seconds to load the local repository (about 200 commits in it). If I click on a commit, it takes about 15 seconds to display the patch.

debugs from fish

Sep 21 18:36:58 |INFO| language: en 
Sep 21 18:36:58 |DEBU| RunCommand command="git --version"
Sep 21 18:36:58 |DEBU| RunCommand command="git rev-parse --git-dir"
Sep 21 18:36:58 |DEBU| RunCommand command="git rev-parse --is-bare-repository"
Sep 21 18:37:03 |INFO| starting main loop 
Sep 21 18:37:03 |INFO| Binary is not built with the buildBinary flag so we won't check for an update 
Sep 21 18:37:03 |DEBU| RunCommand command="git rev-parse --is-bare-repository"
Sep 21 18:37:03 |INFO| refreshing all scopes in async mode 
Sep 21 18:37:03 |DEBU| RunCommand command="git branch -r"
Sep 21 18:37:03 |DEBU| RunCommand command="git stash list --pretty='%gs'"
Sep 21 18:37:03 |DEBU| RunCommand command="git tag --list --sort=-creatordate"
Sep 21 18:37:03 |DEBU| RunCommand command="git for-each-ref --sort=-committerdate --format=\"%(HEAD)%00%(refname:short)%00%(upstream:short)%00%(upstream:track)\" refs/heads"
Sep 21 18:37:03 |DEBU| RunCommand command="git merge-base \"HEAD\" \"HEAD\"@{u}"
Sep 21 18:37:03 |DEBU| Error getting git config value for key: status.showUntrackedFiles. Error: the key is not found for [git config --get --null status.showUntrackedFiles] 
Sep 21 18:37:03 |DEBU| RunCommand command="git status --untracked-files=all --porcelain -z"
Sep 21 18:37:03 |DEBU| RunCommand command="git symbolic-ref --short HEAD"
Sep 21 18:37:03 |DEBU| RunCommand command="git merge-base \"HEAD\" \"master\""
Sep 21 18:37:03 |ERRO| fatal: Not a valid object name master
 
Sep 21 18:37:03 |DEBU| RunCommand command="git for-each-ref --sort=-committerdate --format=\"%(HEAD)%00%(refname:short)%00%(upstream:short)%00%(upstream:track)\" refs/heads"
Sep 21 18:37:13 |DEBU| using cache for key status.showUntrackedFiles 
Sep 21 18:37:13 |DEBU| RunCommand command="git status --untracked-files=all --porcelain -z"

debugs from bash

Sep 21 18:40:35 |DEBU| RunCommand debug=true version="0.35" buildDate="2022-07-20T09:27:56Z" command="git merge-base \"HEAD\" \"HEAD\"@{u}" commit="367b0d331836c90c015bf0c45f88612f3d94d08a"
Sep 21 18:40:35 |DEBU| RunCommand command="git tag --list --sort=-creatordate"
Sep 21 18:40:35 |DEBU| RunCommand command="git branch -r"
Sep 21 18:40:35 |DEBU| RunCommand command="git for-each-ref --sort=-committerdate --format=\"%(HEAD)%00%(refname:short)%00%(upstream:short)%00%(upstream:track)\" refs/heads"
Sep 21 18:40:35 |DEBU| Error getting git config value for key: status.showUntrackedFiles. Error: the key is not found for [git config --get --null status.showUntrackedFiles] 
Sep 21 18:40:35 |DEBU| RunCommand command="git status --untracked-files=all --porcelain -z"
Sep 21 18:40:35 |DEBU| RunCommand command="git for-each-ref --sort=-committerdate --format=\"%(HEAD)%00%(refname:short)%00%(upstream:short)%00%(upstream:track)\" refs/heads"
Sep 21 18:40:35 |DEBU| RunCommand command="git symbolic-ref --short HEAD"
Sep 21 18:40:35 |DEBU| RunCommand command="git merge-base \"HEAD\" \"master\""
Sep 21 18:40:35 |ERRO| fatal: Not a valid object name master
 
Sep 21 18:40:45 |DEBU| using cache for key status.showUntrackedFiles 
Sep 21 18:40:45 |DEBU| RunCommand command="git status --untracked-files=all --porcelain -z"

aureq avatar Sep 21 '22 08:09 aureq

Could you try with a clean fishrc or whats it called? Tried it just now and works okay.

The resizing issue seems in no way connected to the underlying shell.

mark2185 avatar Sep 21 '22 08:09 mark2185

@mark2185 Thank you for the really helpful pointer. As it turn out, performances are degraded when TERM=vte-direct. (I'll update the issue at the top)

aureq avatar Sep 21 '22 08:09 aureq

Welp, at least you know how to work around it until it's fixed.

mark2185 avatar Sep 21 '22 09:09 mark2185

As a workaround, it appears the following settings work fine:

  • TERM=xterm-256color (instead of vte-direct)
  • COLORTERM=truecolor (if not automatically set by your terminal)

aureq avatar Sep 21 '22 09:09 aureq