Skip to content

perf: Parallelize and pre-build RepoGitIndex#11889

Merged
anthonyshew merged 2 commits intomainfrom
shew/more-perf
Feb 17, 2026
Merged

perf: Parallelize and pre-build RepoGitIndex#11889
anthonyshew merged 2 commits intomainfrom
shew/more-perf

Conversation

@anthonyshew
Copy link
Copy Markdown
Contributor

Summary

  • Parallelize git ls-tree and git status inside RepoGitIndex::new using std::thread::scope
  • Pre-build the RepoGitIndex eagerly on a background thread during RunBuilder::build(), overlapping the git I/O with package graph construction
  • Share the pre-built index across calculate_file_hashes and get_internal_deps_hash instead of each building their own

These three git subprocess calls (git ls-tree -r -z HEAD and git status -z) previously ran sequentially and only started after the package graph was fully constructed. They have no data dependency on the package graph — they only need the git binary path and repo root. By starting them earlier and running them in parallel, we hide the entire cost behind work that was already happening.

Benchmarks

Tested with --dry runs across three monorepos of varying sizes.

Large monorepo (~hundreds of packages)

Benchmark 1 (this branch):  6.893 s ± 0.075 s
Benchmark 2 (main):         7.056 s ± 0.059 s

Summary: 1.02 ± 0.01 times faster

Medium monorepo (~100 packages)

Benchmark 1 (this branch):  1.476 s ± 0.108 s
Benchmark 2 (main):         1.784 s ± 0.217 s

Summary: 1.21 ± 0.17 times faster

Small monorepo (~6 packages)

Benchmark 1 (this branch):  672.3 ms ± 25.7 ms
Benchmark 2 (main):         677.1 ms ± 55.4 ms

Summary: 1.01 ± 0.09 times faster (within noise)

The biggest win is in medium-sized repos where the git index build is a larger fraction of total runtime. Small repos fall below the index threshold and are unaffected. Large repos benefit in absolute terms (~163ms) but the percentage improvement is smaller since other work dominates.

@anthonyshew anthonyshew requested a review from a team as a code owner February 17, 2026 20:22
@anthonyshew anthonyshew requested review from tknickman and removed request for a team February 17, 2026 20:22
@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented Feb 17, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
examples-basic-web Ready Ready Preview, Comment, Open in v0 Feb 17, 2026 8:36pm
examples-designsystem-docs Ready Ready Preview, Comment, Open in v0 Feb 17, 2026 8:36pm
examples-gatsby-web Ready Ready Preview, Comment, Open in v0 Feb 17, 2026 8:36pm
examples-kitchensink-blog Ready Ready Preview, Comment, Open in v0 Feb 17, 2026 8:36pm
examples-nonmonorepo Ready Ready Preview, Comment, Open in v0 Feb 17, 2026 8:36pm
examples-svelte-web Ready Ready Preview, Comment, Open in v0 Feb 17, 2026 8:36pm
examples-tailwind-web Ready Ready Preview, Comment, Open in v0 Feb 17, 2026 8:36pm
examples-vite-web Ready Ready Preview, Comment, Open in v0 Feb 17, 2026 8:36pm
turbo-site Ready Ready Preview, Comment, Open in v0 Feb 17, 2026 8:36pm
turborepo-agents Ready Ready Preview, Comment, Open in v0 Feb 17, 2026 8:36pm
turborepo-test-coverage Ready Ready Preview, Comment, Open in v0 Feb 17, 2026 8:36pm

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Feb 17, 2026

Coverage Report

Metric Coverage
Lines 76.41%
Functions 47.24%
Branches 0.00%

View full report

@anthonyshew anthonyshew changed the title perf: Parallelize and pre-build RepoGitIndex for faster turbo run perf: Parallelize and pre-build RepoGitIndex Feb 17, 2026
@anthonyshew anthonyshew merged commit 5cbeef3 into main Feb 17, 2026
103 checks passed
@anthonyshew anthonyshew deleted the shew/more-perf branch February 17, 2026 20:52
github-actions Bot added a commit that referenced this pull request Feb 17, 2026
## Release v2.8.10-canary.8

Versioned docs: https://v2-8-10-canary-8.turborepo.dev

### Changes

- release(turborepo): 2.8.10-canary.7 (#11888) (`a4213a1`)
- perf: Parallelize and pre-build RepoGitIndex (#11889) (`5cbeef3`)

---------

Co-authored-by: Turbobot <turbobot@vercel.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant