Skip to content

WSL backend: a project on a Windows drive (/mnt/c) makes git status take 41 s instead of 0.1 s, with no warning #36675

Open

Description

@juliusmarminge

Problem

With the WSL backend, a project that lives on a Windows drive is reached through /mnt/c, and every git and file operation on it is 100 to 350 times slower than the same repository inside the distro. git status on this repository takes 41.5 s. The folder picker offers Windows folders for the WSL backend and translates them with wslpath (apps/desktop/src/ipc/methods/window.ts). I found no warning there about what that choice costs.

Numbers

Windows Server 2025, 4 vCPU (Xeon Platinum 8370C), 16 GB, NTFS, Git for Windows 2.56.1, Node 26.13.1, Defender on with default settings and no exclusions, commit ca6e09c. The Linux baseline is WSL2 Ubuntu 24.04 (ext4, git 2.43) on the same machine.

The same checkout of this repository (with node_modules installed) on C:\ read from inside WSL, against a clone in the distro's home. Median of 2 to 3 runs, ms:

/mnt/c/... ext4
git rev-parse HEAD 55 2
git status --porcelain=2 --branch 41,550 118
git diff-index -M --numstat HEAD 28,172 32
git ls-files --others --exclude-standard 11,989 70

From Node inside WSL, same two trees:

/mnt/c/... ext4
Walk the source tree (no node_modules, no .git) 40,194 487
Walk including node_modules 198,326 2,250
stat 3,000 files, one at a time 15,534 219
stat 3,000 files, in parallel 1,268 34
Read 3,000 small files 19,185 258

A status refresh runs status, diff-index and ls-files --others twice each (see #36673), so one refresh of a project on /mnt/c is minutes of git time, and the 30 s status poll never catches up.

Cause

/mnt/c is a 9p mount of the Windows file system. Each stat crosses the VM boundary and costs about 5 ms here. Nothing in T3 Code is wrong per call; the product puts a project there without saying so. I measured git and the file system directly, not the app running on such a project.

What would help

  • Say so where the choice is made: when a folder picked for a WSL environment resolves to a drive mount, tell the user it will be slow and that cloning into the distro's home is the fix.
  • The same check could mark existing projects in a WSL environment whose path is on a drive mount.

Reproduce

In WSL on a Windows machine, with a repository cloned at C:\src\t3code and again at ~/t3code:

git config --global --add safe.directory '*'
for d in /mnt/c/src/t3code ~/t3code; do
  cd "$d" && for c in "rev-parse HEAD" "status --porcelain=2 --branch" "diff-index -M --numstat HEAD" "ls-files --others --exclude-standard"; do
    s=$(date +%s%N); git $c >/dev/null; echo "$d  git $c  $(( ($(date +%s%N)-s)/1000000 )) ms"
  done
done

Measured and written by Claude Fable 5.2 in Claude Code (T3 Code).

Activity

  1. juliusmarminge commented on Nov 14, 2026

    @juliusmarminge
    Author
  2. SunkenInTime commented on Nov 15, 2026

    @SunkenInTime
    Contributor

    Reproduced on my machine (Ryzen 7 5800X, Windows 11, WSL 2.7.11, Ubuntu 26.04), and I think there's a second cause that's bigger than the mount.

    Fresh clones of this repo at fbfebc8 (no node_modules), git status --porcelain=2 --branch run with the server's environment (GIT_OPTIONAL_LOCKS=0):

    Clone Time
    Inside the distro (ext4) 0.27 s
    /mnt/c, cloned with Git for Windows 243–504 s
    /mnt/e, cloned with Git for Windows (Defender-excluded) 274 s

    The mount cost is real: one lstat is about 3 ms there against 0.003 ms on ext4. But that only accounts for 23–35 s of it.

    The rest is the index. Git for Windows writes inode, uid and gid as 0. Linux git sees real values, treats every entry as possibly changed, and reads and hashes every tracked file. It would normally save the refreshed index, but we run git with GIT_OPTIONAL_LOCKS=0 (GitVcsDriverCore.ts), so it can't, and every status poll repeats the full read.

    Same clone on /mnt/e, same environment:

    Condition Time
    Windows-written index 274 s
    With -c core.checkStat=minimal 35 s
    After one plain git status from WSL rewrote the index 23 s

    So of the 274 s, about 251 s (92%) is the re-read and about 23 s (8%) is the mount.

    The repro script in this issue runs plain git status, which lets git fix the index on the first run, so I think the 41 s here is the mount-only number.

    This hits anyone who cloned on Windows and then adds that folder to a WSL environment, which is the path the folder picker opens. It probably goes both ways too: after WSL git rewrote the index on E:, native Git for Windows took 4.9 s for status against 1.0 s on the untouched C: clone (different drives, so not a clean before/after).

    The warning still makes sense. Passing core.checkStat=minimal for repos on a drive mount might also be worth a look; I haven't checked it for side effects.

    Not tested: the app itself on such a project. These are git timings only, one to three runs each.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions