Open carlolars opened 1 year ago
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.
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! https://github.com/microsoft/WSL/discussions/9412
Recently, there was a news of huge performance boost in 9p: https://lwn.net/Articles/918213/
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 ?
@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):
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.
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:
(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:
(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
andgit
.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 newWSLGIT_DEFAULT_DIST
variable by using the following PowerShell command:From a bash-shell in WSL1/WSL2 I used the
time
command and in PowerShell I used theMeasure-Command
to measure the time: