# Benchmarks Benchmarks on vercel/next.js: Cleft creates worktrees 5.2 times faster than git and uses 17.7 times less disk on APFS. ## Verified APFS results Measured on an Apple M5 (10 CPUs, 16 GiB RAM) running macOS on APFS, with Apple Git and Cleft. Source repository: `vercel/next.js` at `f9e8eefcd32d2eb40bc377a0bd35ca8899c66761` (35,856 tracked paths) and `HEAD~200` at `254c50c3fd10e377ef315fe89cb6c4b3964fd985` (1,679 changed paths, 962 non-deleted changed files totaling 47.87 MiB logical). Single-worktree wall times, first `git status`, `Add+Status`, and index sizes are 10 interleaved round-robin runs (`seed=0`, 1 warmup excluded) on the native APFS SSD. Physical disk deltas are 3-round medians measured on a dedicated Spotlight-disabled 4 GiB APFS sparse volume (`hdiutil`) so unrelated macOS background writes do not skew `statvfs`. Two-sided Mann-Whitney U p-values compare creation wall time against `cleft`. Scroll the tables sideways to see every column. ### Revision HEAD (f9e8eefcd32d, 10 runs) | Tool | Wall median (s) | IQR (s) | p95 (s) | Speedup vs Git | p vs cleft | Status (ms) | Add+Status (s) | Index (MiB) | Isolated Disk (MiB) | | --- | ---: | ---: | ---: | ---: | ---: | ---: | ---: | ---: | ---: | | git | 4.4519 | 1.4568 | 6.2319 | 1.00x | 1.083e-05 | 777.189 | 5.1835 | 5.2432 | 299.50 | | cleft | 0.8541 | 0.1809 | 1.1052 | 5.21x | - | 754.175 | 1.6182 | 3.3655 | 16.88 | | cleft-hash | 1.1203 | 0.1232 | 1.4195 | 3.97x | 0.0007253 | 553.544 | 1.6694 | 3.3655 | 16.92 | | git-coworktree | 2.9682 | 0.6773 | 3.9405 | 1.50x | 1.083e-05 | 817.155 | 3.8116 | 5.2432 | 18.74 | | git-twig | 8.4285 | 1.4245 | 10.3280 | 0.53x | 1.083e-05 | 612.303 | 8.9852 | 4.6342 | 17.96 | | git-cow | 2.3482 | 0.5816 | 3.2266 | 1.90x | 1.083e-05 | 493.757 | 2.8595 | 5.2432 | 18.71 | ### Revision HEAD~200 (254c50c3fd10, 10 runs) | Tool | Wall median (s) | IQR (s) | p95 (s) | Speedup vs Git | p vs cleft | Status (ms) | Add+Status (s) | Index (MiB) | Isolated Disk (MiB) | | --- | ---: | ---: | ---: | ---: | ---: | ---: | ---: | ---: | ---: | | git | 3.4564 | 0.7161 | 4.5294 | 1.00x | 1.083e-05 | 706.688 | 4.1645 | 5.1440 | 295.42 | | cleft | 0.8781 | 0.1074 | 0.9421 | 3.94x | - | 770.893 | 1.6396 | 3.3122 | 65.95 | | cleft-hash | 1.1908 | 0.2307 | 1.5994 | 2.90x | 1.083e-05 | 714.029 | 1.9011 | 3.3122 | 65.98 | | git-coworktree | 2.8657 | 0.6246 | 3.6636 | 1.21x | 1.083e-05 | 758.290 | 3.5758 | 5.1440 | 68.93 | | git-twig | 8.1781 | 1.9107 | 10.3123 | 0.42x | 1.083e-05 | 534.113 | 8.6969 | 4.5432 | 68.47 | | git-cow | 2.3798 | 0.2014 | 2.7784 | 1.45x | 1.083e-05 | 568.665 | 2.9984 | 5.1440 | 68.98 | ### 8 concurrent worktrees at HEAD (3 rounds x 8 workers) | Tool | Batch median (s) | All 3 batches (s) | Speedup vs Git | Workers passed | | --- | ---: | --- | ---: | ---: | | cleft | 5.685 | 5.635, 5.685, 5.759 | 2.92x | 24/24 | | cleft-hash | 7.272 | 7.184, 7.272, 7.376 | 2.28x | 24/24 | | git-cow | 10.338 | 9.538, 10.338, 11.427 | 1.61x | 24/24 | | git | 16.611 | 16.042, 16.611, 20.128 | 1.00x | 24/24 | | git-coworktree | 17.509 | 15.835, 17.509, 19.560 | 0.95x | 24/24 | | git-twig | 28.943 | 24.687, 28.943, 31.230 | 0.57x | 24/24 | ### How to compare the tools - `cleft` (`--verify=stat`) and `cleft-hash` (`--verify=hash`) show both verification modes. Compare metadata verification with `git-cow` and `git-coworktree`, and hash verification with `git-twig`. - `git-cow add` runs `git status` and `git clean -ffd` before returning, warming directory blocks for the subsequent `git status` at the cost of roughly 0.5 s during creation. Passing `--untracked` to `git-cow` skips `git clean -ffd` and raises its first `git status` into the same range as `cleft` while still remaining slower end to end. - On `HEAD~200`, `cleft` finishes in under 1 second, so newly materialized files land in the same integer second as the newly written index; Git's racy-git check therefore rehashes those files during the first `git status` (the same behavior stock `git worktree add` shows). `Add+Status` captures the full end-to-end cost through a clean `git status`. - Under heavier contention or colliding worktree basenames, tools that delegate registration to `git worktree add` can fail on Git's `.git/worktrees//commondir` race; `bench/bench.py` records swarm pass counts per tool so failures do not abort the run. ## Run the comparison Build Cleft, then run the benchmark on a clean local clone. Keep the source, Git metadata and new worktrees on the same quiet volume. Use APFS on macOS, or XFS with reflinks enabled or Btrfs on Linux. Keep worktree hooks and Git wrappers out of the run. ```sh python3 bench/bench.py --cleft ./cleft --repo /path/to/clean/repo \ --scratch /path/on/benchmark-volume --revs HEAD,HEAD~200 --runs 10 \ --cleft-hash --auto-competitors --swarm 8 \ --markdown-out bench-results.md --json-out bench-results.json ``` The runner uses a fresh destination every time. After one warmup, it rotates a seeded tool order each round without flushing the page cache. See the [benchmark protocol](https://github.com/arcadia-eng/cleft/blob/5c575db/bench/README.md) for the pinned competitor builds and the full reproduction procedure. ## Read the measurements - **Creation:** Wall time from command startup to completion. The table shows the median, interquartile range (IQR) and p95. - **First status:** The first external `git status --porcelain` after creation. Add+Status reports the median of the combined times. Index size is measured after that status. - **Disk:** The change in allocated space reported by `statvfs`, with a sync before each reading. It includes checkout data and metadata, not already shared extents. - **Concurrent worktrees:** Batch time runs from releasing all workers to the last completion. The table reports how many worktree creations passed. - **Significance:** Each p-value compares creation time with Cleft using the two-sided Mann-Whitney U test. The values do not adjust for multiple comparisons or correlations between rounds.