perf: Pre-compile glob exclusion filter and cache path prefix in file hashing#11891
Merged
anthonyshew merged 1 commit intomainfrom Feb 17, 2026
Merged
perf: Pre-compile glob exclusion filter and cache path prefix in file hashing#11891anthonyshew merged 1 commit intomainfrom
anthonyshew merged 1 commit intomainfrom
Conversation
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
f23b163 to
6232d6d
Compare
6232d6d to
f5a45e8
Compare
Contributor
Coverage Report
|
github-actions Bot
added a commit
that referenced
this pull request
Feb 18, 2026
## Release v2.8.10-canary.9 Versioned docs: https://v2-8-10-canary-9.turborepo.dev ### Changes - release(turborepo): 2.8.10-canary.8 (#11890) (`31e29c9`) - perf: Pre-compile glob exclusion filter and cache path prefix in file hashing (#11891) (`2af1c0d`) --------- 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
globwalk_internalinstead of cloningVec<Glob>per include pattern and re-compiling each time. AddsFileIterator::not_anyto wax to accept a pre-compiledFilterAnydirectly.hash_objectsso each file does a cheapstrip_prefixinstead of fullrelative_path_betweenpath component iteration.Why
CPU profiling showed
get_package_file_hashesas the dominant hotspot (538% self time). Within that path,globwalk_internalwas cloning and re-compiling exclusionGlobpatterns (each containing a compiledRegex) for every include glob — O(N includes × M excludes) regex clones + N recompilations per globwalk call. Inhash_objects, the path prefix computation was doing redundant component iteration for every file when the relationship between git root and package path is constant.Benchmarks
Measured with
hyperfine --warmup 5across three monorepos of different sizes:~300 packages:
~100 packages:
~6 packages:
Improvements scale with package count as expected since both optimizations eliminate per-package redundant work.
Testing
All existing tests pass across
wax,globwalk,turborepo-scm, andturborepo-task-hash.