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

Performance Measurements #131

Open
carlolars opened this issue Jul 25, 2022 · 4 comments
Open

Performance Measurements #131

carlolars opened this issue Jul 25, 2022 · 4 comments

Comments

@carlolars
Copy link
Contributor

When I implemented #129 I did some simple performance measurements and I thought I'd share the results.

Test Results

WSL2 Filesystem

Clone from WSL2 to WSL2 filesystem:

git clone time
wsl2 0.580s
wslgit-wsl2 0.786s

(I also ran this test on my work laptop that is ~8 years newer than my private desktop and the measured times were 0.404s and 0.455s, so on modern hardware the wslgit overhead is even lower)

Windows Filesystem

Clone from Windows filesystem to Windows filesystem:

git clone time
win64 5.769s
wsl1 11.837s
wslgit-wsl1 11.800s
wsl2 63.448s
wslgit-wsl2 63.879s

(Unfortunately I cannot disable the antivirus on my work-laptop so it is actually slower than my old desktop)

Anitvirus

The AV can have a huge impact on the git performance. On my desktop I use Microsoft Defender Antivirus where it is possible to exclude folders and processes. I ran this test using git from my WSL1 instance (Alpine Linux) and tried combinations of disabling then folder and the processes. The nice thing about WSL1 is that the processes are actually visible by Windows so it is possible to add WSL1 processes to the exclusion list, for Alpine Linux the processes to exclude are busybox and git.

exclusion clone time
- 48.708s
Processes (busybox+git) 11.689s
Folder 12.981s
Folder + Processes 11.577s

The results indicate that it is actually better to exclude the processes rather than the folder.

Test Method

I first cloned the microsoft/vscode repository to the local disk and then measured the time it took to clone from the local copy to a destination on the same filesystem (Win->Win, and WSL2->WSL2) using wslgit, git for windows (64-bit), and git inside WSL1 and WSL2.

When running wslgit on the Windows filesystem the WSL-distro to use was selected using the new WSLGIT_DEFAULT_DIST variable by using the following PowerShell command:

$env:WSLGIT_DEFAULT_DIST="MyWSL1Dist"

From a bash-shell in WSL1/WSL2 I used the time command and in PowerShell I used the Measure-Command to measure the time:

Measure-Command { wslgit clone vscode vscode-1 }
time git clone vscode vscode-1

Don't forget to delete vscode-1 before running again.

@andy-5
Copy link
Owner

andy-5 commented Aug 2, 2022

Thanks for sharing your results, very interesting.

Didn't expect that native Git on Windows is ~10x slower than Git inside WSL2.

And the difference between WSL1 and WSL2 accessing the Windows filesystem seems to be about 5x.

So it looks like keeping everything inside WSL2 is ideal. And for accessing Windows filesystems, WSL1 (or native Windows Git) seems to be the way to go.

@i2
Copy link

i2 commented Jan 18, 2023

Interesting. I too noticed git in wsl2 is much faster than calling git that is installed in WSL2 from Windows side. Is there any chance the performance can be improved? I created an issue in WSL2 repo, but so far no love! microsoft/WSL#9412

Recently, there was a news of huge performance boost in 9p: https://lwn.net/Articles/918213/

@TBG-FR
Copy link

TBG-FR commented Nov 24, 2023

Nobody noticed performances issues inside VSCode after installing wslgit ? Everytime I created a file/folder through VSCode GUI (on windows side, not connected inside WSL or anything), it's very slow now

There's a "Running 'File Create' participants" notification, could it be that VSCode calls git on each file creation ?

@andy-5
Copy link
Owner

andy-5 commented Nov 27, 2023

@TBG-FR VSCode indeed calls git several times for each new file. You can see the exact commands, including timing information, in the "Output" pane in VSCode (select "Git" from the dropdown on the right).

There are several factors that can cause performance issues (see benchmarks above):

  • Which filesystems are involved
  • Which version of WSL is used for Git
  • Startup scripts in the WSL environment
  • Antivirus software
  • ...

The benchmarks above also show that the overhead of wslgit itself is very small. Overall performance mostly depends on the performance of WSL accessing the filesystem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants