perf: Replace libgit2 git status with gix-index for faster file hashing#11950
Merged
anthonyshew merged 5 commits intomainfrom Feb 21, 2026
Merged
perf: Replace libgit2 git status with gix-index for faster file hashing#11950anthonyshew merged 5 commits intomainfrom
libgit2 git status with gix-index for faster file hashing#11950anthonyshew merged 5 commits intomainfrom
Conversation
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
libgit2 git status with gix-index for faster file hashing
6949dc9 to
139515a
Compare
Contributor
Coverage Report
|
github-actions bot
added a commit
that referenced
this pull request
Feb 21, 2026
## Release v2.8.11-canary.18 Versioned docs: https://v2-8-11-canary-18.turborepo.dev ### Changes - release(turborepo): 2.8.11-canary.17 (#11949) (`51cb58b`) - perf: Replace `libgit2` git status with `gix-index` for faster file hashing (#11950) (`eba684f`) --------- Co-authored-by: Turbobot <turbobot@vercel.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Replaces
RepoGitIndex's libgit2-basedgit ls-tree+git statuswith a new code path that reads the.git/indexfile directly viagix-index. This eliminates the most expensive git operation inturbo runby combining two separate libgit2 calls into a single index read + parallel stat comparison.Results
Profile data (
RepoGitIndex::new):Wall-clock benchmarks (hyperfine,
--dry --skip-infer, 10+ warmup, 10+ runs):Measured with
--profileon three private repos of different sizes. All profiles taken on the same machine, same base commit, clean working trees.The medium repo shows the biggest wall-clock improvement because git operations are a larger fraction of total run time. The large repo has a smaller relative improvement because other operations (engine build, lockfile parsing, globwalk) dominate.
Why
git_status_repo_root(via libgit2'srepo.statuses()) was the single most expensive operation inturbo run, consuming 30-70% of total profiled duration depending on repo size. It stat-checks every tracked file AND walks the entire working tree for untracked files in a single-threaded C call.What Changed
New gix-index code path (
repo_index.rs):.git/indexviagix-index(mmap'd, ~2-5ms) to get every tracked file's blob OID and cached stat datagix_index::entry::Stat::matches()hash_objectsinstead of content-hashing inline — avoids reading every file from disk on fresh checkoutsuse_nsec: true) to reduce false racy entries on modern filesystems (APFS, ext4)ignorecrate's parallel walker (respects.gitignore)Dependency changes:
gix-indexas an optional dependency behind agixfeature flag (~27 new crates, all pure Rust)Optimizations applied:
ls_tree_hashes(git index is already sorted, rayon preserves order)ObjectIdcarried through the parallel loop, hex string allocated only for clean entriesHashSetfor untracked file detectionTest coverage:
test_utils.rs)