Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Git is very slow under WSL2 when working with our medium-sized repos hosted on Windows filesystems (required by our Windows-only tooling). It's not unusable, but 'git status' under WSL1 was almost instant, whereas it takes a good few seconds under WSL2.


It’s due to what is effectively a network file system. You have the same issue with nfs, 9pfs, parallels prl_fs, etc. It has to stat every file in the repo and that gets expensive on ang RPC protocol. Even local ones apparently.

This is made worse because git uses the os-specific file statistics including inode number to track file changes. These change over most such file systems types which triggers it to rebuild the entire file cache every time you switch OS running git commands. Which if you have shell integration is constantly.

I share my git repos between MacOS and a Linux volume and it hurts on any repo with 100s of thousands of files or more. Ceph, Linux kernel, etc.


Turns out you guys are right. I tried a bigger repo and it was slow. I tried our large monorepo and it was utterly unusable (literally minutes for git status).

I've found this thorough explanation https://github.com/microsoft/WSL/issues/4197#issuecomment-60...


I have git for windows installed and then alias git=git.exe so git from WSL just calls windows git which is much faster and I've never noticed any issues with this.

I also use WSL1 though so maybe my setup is weird.


The github link I posted elsewhere explains why WSL1 is far more performant, most don't need that hack in the WSL1 case (but doesn't hurt).




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: