Repository navigation
perf: Reduce CPU overhead in turbo run hot path - #11947
Merged
Merged
Conversation
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
turbo run hot path
anthonyshew
force-pushed
the
faster-and-faster
branch
from
February 21, 2026 02:11
af4e949 to
ec8e82d
Compare
Eliminate fork+exec overhead for the three hottest git subprocess calls in turbo run startup: WorktreeInfo::detect, git ls-tree, and git status. Replace with in-process libgit2 equivalents (Repository::discover, tree.walk, repo.statuses). Also skip expensive TaskSummary construction and SCMState::get when neither --dry nor --summarize is set, and use sorted Vec instead of BTreeMap for ls-tree results for better cache locality.
anthonyshew
force-pushed
the
faster-and-faster
branch
from
February 21, 2026 02:17
ec8e82d to
e5c04f2
Compare
Contributor
Coverage Report
|
anthonyshew
force-pushed
the
faster-and-faster
branch
from
February 21, 2026 02:24
e5c04f2 to
28991ee
Compare
github-actions Bot
added a commit
that referenced
this pull request
Feb 21, 2026
## Release v2.8.11-canary.17 Versioned docs: https://v2-8-11-canary-17.turborepo.dev ### Changes - release(turborepo): 2.8.11-canary.16 (#11944) (`037b7ba`) - perf: Reduce CPU overhead in `turbo run` hot path (#11947) (`a0e90cb`) --------- Co-authored-by: Turbobot <turbobot@vercel.com>
This branch was successfully deployed
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
Several targeted optimizations to reduce CPU time in
turbo run's critical path. These changes reduce allocations, eliminate redundant computation, and improve algorithmic complexity in per-package operations.Per-function improvements (absolute self-time)
calculate_task_hashwalk_globcalculate_task_hashwalk_globto_summaryChanges
Binary-search status lookups in
RepoGitIndex: Status entries are now sorted at index build time. Per-package filtering usespartition_pointfor O(log N) range queries instead of O(N) linear scans. Matters when both package count and dirty-file count are large.Precompute external dependency hashes per-package:
get_external_deps_hashsorts transitive dependencies and hashes them. Previously this ran for every task. Now it runs once per package and is cached, since multiple tasks in the same package produce the same hash.TaskHashable.external_deps_hashchanged fromOption<String>toOption<&str>to avoid cloning from the cache.Combined branch+SHA libgit2 lookup:
to_summarypreviously opened the git repo twice (once for branch, once for SHA). Now a singleRepository::opencall retrieves both.Reuse buffers in ls-tree and hash-object walks: The tree walk and hash-object loops now reuse a
Stringpath buffer and a[u8; 40]hex buffer instead of allocating per entry. Useshex::encode_to_sliceinstead ofgit2::Oid::to_string.Wall-clock caveat
These CPU improvements don't translate cleanly to wall-clock time in benchmarks because
git statusandgit ls-treevia libgit2 dominate total runtime (30-80% of profiled duration) and have high I/O variance between runs. The functions we optimized are real work that runs on everyturbo run, but measuring end-to-end improvement requires many runs to overcome the git I/O noise floor.Testing
All existing tests pass. Added regression tests for: