Skip to content

git diff being insanely slow #2151

@shodanium

Description

@shodanium
  • I was not able to find an open or closed issue matching what I'm seeing

Setup

  • Which version of Git for Windows are you using? Is it 32-bit or 64-bit?
C:\>git --version --build-options
git version 2.21.0.windows.1
cpu: x86_64
built from commit: 2481c4cbe949856f270a3ee80c802f5dd89381aa
sizeof-long: 4
sizeof-size_t: 8
  • Which version of Windows are you running? Vista, 7, 8, 10? Is it 32-bit or 64-bit?
$ cmd.exe /c ver
Microsoft Windows [Version 10.0.16299.1029]
  • What options did you set as part of the installation? Or did you choose the
    defaults?
# One of the following:
> type "C:\Program Files\Git\etc\install-options.txt"
> type "C:\Program Files (x86)\Git\etc\install-options.txt"
> type "%USERPROFILE%\AppData\Local\Programs\Git\etc\install-options.txt"
C:\>type "C:\bin\Git\etc\install-options.txt"
Editor Option: Notepad++
Custom Editor Path:
Path Option: CmdTools
SSH Option: OpenSSH
CURL Option: OpenSSL
CRLF Option: CRLFCommitAsIs
Bash Terminal Option: MinTTY
Performance Tweaks FSCache: Enabled
Use Credential Manager: Enabled
Enable Symlinks: Enabled
  • Any other interesting things about your environment that might be related
    to the issue you're seeing?

The environment is IMO rather bland. The issue is not related to antivirus (Windows Defender etc are all disabled).

Details

  • Which terminal/shell are you running Git from? e.g Bash/CMD/PowerShell/other

cmd.exe and FAR, same situation in both cases

git diff
  • What did you expect to occur after running these commands?

I expect a diff in less than 1 second (less than 0.1 second actually).

  • What actually happened instead?

I get a diff but in 15-20 seconds. Immediately running "git diff" again would actually complete in 0.1 seconds or less. However, after a trivial amount of work in a different window (say, edit a source file a little and save it), git diff would be insanely slow again.

Z:\work\...\generator>timeit git diff
command took 0:0:15.74 (15.74s total)

Z:\work\...\generator>timeit c:\bin\git\bin\git.exe diff
command took 0:0:19.75 (19.75s total)

Z:\work\...\generator>timeit c:\bin\git\bin\git.exe diff
command took 0:0:16.21 (16.21s total)

Neither CPU nor disk activity is reported by Task Manager during that slowdown. 0-1% CPU usage, 0-1% disk activity. I would assume that "git diff" does NOT do any network activity, huh.

GIT_TRACE output exists, but is is less than useful:
Z:\work...\generator>timeit git diff
15:18:56.996500 exec-cmd.c:236 trace: resolved executable dir:
C:/Bin/Git/mingw64/bin
15:18:56.997001 git.c:419 trace: built-in: git diff
15:18:56.999006 run-command.c:643 trace: run_command: unset
GIT_PAGER_IN_USE; LESS=FRX LV=-c less
command took 0:0:15.51 (15.51s total)

ProcMon output indicates that git manages to scan the FS real quick, and
then just sits doing nothing (waiting for 4 threads, that in turn are
sitting doing nothing, to complete???) for about 15 seconds. The following is from ProcMon and the last column is TID:

3:00:35.4799875 PM	git.exe	7316	QueryOpen	Z:\work\...\structure.pp	SUCCESS	CreationTime: 3/12/2019 5:52:24 PM, LastAccessTime: 3/26/2019 1:52:27 PM, LastWriteTime: 3/26/2019 1:52:27 PM, ChangeTime: 3/26/2019 1:52:27 PM, AllocationSize: 4,096, EndOfFile: 2,593, FileAttributes: ANCI	12068
3:00:51.2974759 PM	git.exe	7316	Thread Exit		SUCCESS	Thread ID: 11572, User Time: 0.0000000, Kernel Time: 0.0000000	11572
3:00:51.2975934 PM	git.exe	7316	Thread Exit		SUCCESS	Thread ID: 8756, User Time: 0.0000000, Kernel Time: 0.0000000	8756
3:00:51.2976240 PM	git.exe	7316	Thread Exit		SUCCESS	Thread ID: 13400, User Time: 0.0000000, Kernel Time: 0.0000000	13400
3:00:51.2976519 PM	git.exe	7316	Thread Exit		SUCCESS	Thread ID: 10932, User Time: 0.0000000, Kernel Time: 0.0000000	10932
3:00:51.2976537 PM	git.exe	7316	RegCloseKey	HKCU\Software\Classes\Local Settings\Software\Microsoft	SUCCESS		12068
3:00:51.2976681 PM	git.exe	7316	RegCloseKey	HKCU\Software\Classes\Local Settings	SUCCESS		12068
3:00:51.2976963 PM	git.exe	7316	RegCloseKey	HKLM\SOFTWARE\Microsoft\Ole	SUCCESS		12068
3:00:51.2977062 PM	git.exe	7316	RegCloseKey	HKLM	SUCCESS		12068
3:00:51.2978077 PM	git.exe	7316	RegOpenKey	HKLM\Software\Microsoft\Windows NT\CurrentVersion\GRE_Initialize	SUCCESS	Desired Access: Read	12068
3:00:51.2978293 PM	git.exe	7316	RegQueryValue	HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\GRE_Initialize\DisableMetaFiles	NAME NOT FOUND	Length: 20	12068
3:00:51.2978444 PM	git.exe	7316	RegCloseKey	HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\GRE_Initialize	SUCCESS		12068
3:00:51.2979467 PM	git.exe	7316	Thread Exit		SUCCESS	Thread ID: 12068, User Time: 0.0000000, Kernel Time: 0.0781250	12068
3:00:51.2993663 PM	git.exe	7316	QueryNameInformationFile	C:\Bin\Git\mingw64\bin\libintl-8.dll	SUCCESS	Name: \Bin\Git\mingw64\bin\libintl-8.dll	12068
  • If the problem was occurring with a specific repository, can you provide the
    URL to that repository to help us with testing?

Nope, private work repo. Seeing this issue with different repos though.

Also, all my attempts to post to mailing list failed for some reason.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions