1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-10-22 06:52:19 +03:00

Improve CPU usage when flicking through large diffs

The previous commit already fixed the user-visible lag, but there's still a
problem with multiple background git processes consuming resources calculating
diffs that we are never going to show. Improve this by terminating those
processes (by sending them a TERM signal).

Unfortunately this is only possible on Linux and Mac, so Windows users will have
to live with the higher CPU usage. The recommended workaround is to not use
"diff.algorithm = histogram".
This commit is contained in:
Stefan Haller
2025-08-08 19:55:16 +02:00
parent 898f565116
commit e056e33da5
3 changed files with 28 additions and 0 deletions

View File

@@ -3,6 +3,7 @@ package oscommands
import (
"fmt"
"os"
"os/exec"
"path/filepath"
)
@@ -22,3 +23,8 @@ func (c *OSCommand) UpdateWindowTitle() error {
argString := fmt.Sprint("title ", filepath.Base(path), " - Lazygit")
return c.Cmd.NewShell(argString, c.UserConfig().OS.ShellFunctionsFile).Run()
}
func TerminateProcessGracefully(cmd *exec.Cmd) error {
// Signals other than SIGKILL are not supported on Windows
return nil
}