While profiling Git on a large repository, I found that git status is significantly (10x) slower on mac compared to linux. git status runs lstat on every file in the repository, which is where the slowness comes from.
Is there a particular reason why this syscall is much slower on macs compared to linux?
Check first you version of Git, as there have been improvements in recent Git version (like
git addin 2.20, git stash in 2.22 and even the upcoming 2.27 with submodules).Even
git statusimproved with Git 2.24One analysis of the difference of lstats in APFS compared to Ext4 was done in "Global Kernel Locks in APFS" by Gregory Szorc: