Skip to content

perf: Avoid normalizing git index path joins#12944

Merged
anthonyshew merged 1 commit into
mainfrom
shew/optimize-git-index-path-joins
Jun 24, 2026
Merged

perf: Avoid normalizing git index path joins#12944
anthonyshew merged 1 commit into
mainfrom
shew/optimize-git-index-path-joins

Conversation

@anthonyshew

@anthonyshew anthonyshew commented May 25, 2026

Copy link
Copy Markdown
Contributor

Why

Building the repo git index joins every normalized git-index path to the repository root before stat comparison. The normal join path cleans every joined path, which adds allocation churn in a hot turbo run planning path.

Using the new heap profiling, turbo run build --dry=json on this repository showed this path accounting for about 9.25 MiB and 18k allocations. Avoiding the normalization step removed about 12 MiB and 55k total allocations from that dry run. Additional local hyperfine runs showed roughly 3-5% improvement.

What

Adds a narrowly named join_unix_path_unchecked helper for already-normalized relative Unix paths and uses it when statting entries from .git/index.

The existing join_unix_path remains the safe/default API for callers that need . or .. normalization.

How

Verified with:

Benchmarked locally with release-turborepo binaries using TURBO_TELEMETRY_DISABLED=1 turbo run build --dry=json.

Representative 30-run hyperfine sample:

  • Before: 710.2 ms ± 135.2 ms
  • After: 670.5 ms ± 80.4 ms

@vercel

vercel Bot commented May 25, 2026

Copy link
Copy Markdown
Contributor

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 May 25, 2026 4:31am
examples-designsystem-docs Ready Ready Preview, Comment, Open in v0 May 25, 2026 4:31am
examples-gatsby-web Ready Ready Preview, Comment, Open in v0 May 25, 2026 4:31am
examples-kitchensink-blog Ready Ready Preview, Comment, Open in v0 May 25, 2026 4:31am
examples-nonmonorepo Ready Ready Preview, Comment, Open in v0 May 25, 2026 4:31am
examples-svelte-web Ready Ready Preview, Comment, Open in v0 May 25, 2026 4:31am
examples-tailwind-web Ready Ready Preview, Comment, Open in v0 May 25, 2026 4:31am
examples-vite-web Ready Ready Preview, Comment, Open in v0 May 25, 2026 4:31am
turbo-site Ready Ready Preview, Comment, Open in v0 May 25, 2026 4:31am

@anthonyshew anthonyshew marked this pull request as ready for review June 24, 2026 18:21
@anthonyshew anthonyshew requested a review from a team as a code owner June 24, 2026 18:21
@anthonyshew anthonyshew requested review from tknickman and removed request for a team June 24, 2026 18:21
@anthonyshew anthonyshew merged commit 417c28d into main Jun 24, 2026
44 checks passed
@anthonyshew anthonyshew deleted the shew/optimize-git-index-path-joins branch June 24, 2026 18:21
anthonyshew pushed a commit that referenced this pull request Jun 25, 2026
## Release v2.10.1-canary.1

> [!CAUTION]
> Versioned docs aliasing FAILED. [View
logs](https://github.com/vercel/turborepo/actions/runs/28187593190)

### Changes

- release(turborepo): 2.9.19-canary.10 (#13130) (`a12323b`)
- release(turborepo): 2.10.0 (#13131) (`6939250`)
- docs: Add Turborepo 2.10 release post and update docs (#13096)
(`c07e48f`)
- perf: Avoid normalizing git index path joins (#12944) (`417c28d`)
- chore: Remove tbx package (#13133) (`7bebb26`)
- feat: Migrate TUI virtual terminals from vt100 to Ghostty (#13135)
(`b22d3b4`)
- chore: Add examples maintenance agent (#13136) (`05ac7b5`)
- chore: Remove a few pre-push hooks (#13137) (`5eb24eb`)
- ci: Making sure Zig works in releases (#13138) (`39340f1`)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
anthonyshew pushed a commit that referenced this pull request Jun 29, 2026
## Release v2.10.1

> [!CAUTION]
> Versioned docs aliasing FAILED. [View
logs](https://github.com/vercel/turborepo/actions/runs/28399666958)

### Changes

- release(turborepo): 2.10.0 (#13131) (`6939250`)
- docs: Add Turborepo 2.10 release post and update docs (#13096)
(`c07e48f`)
- perf: Avoid normalizing git index path joins (#12944) (`417c28d`)
- chore: Remove tbx package (#13133) (`7bebb26`)
- feat: Migrate TUI virtual terminals from vt100 to Ghostty (#13135)
(`b22d3b4`)
- chore: Add examples maintenance agent (#13136) (`05ac7b5`)
- chore: Remove a few pre-push hooks (#13137) (`5eb24eb`)
- ci: Making sure Zig works in releases (#13138) (`39340f1`)
- release(turborepo): 2.10.1-canary.1 (#13139) (`69a743e`)
- fix: Support Corepack packageManager integrity hashes (#13123)
(`6bf6a67`)
- fix(env): Add XDG_DATA_* to pass-through (#13145) (`0b3b4a6`)
- release(turborepo): 2.10.1-canary.2 (#13147) (`e844c15`)
- feat: Support `devEngines.packageManager` (#12388) (`e48c56c`)
- feat: Support devEngines packageManager in workspaces (#13150)
(`9d94ae5`)
- release(turborepo): 2.10.1-canary.3 (#13149) (`0d32225`)
- feat: Update add package manager codemod (#13151) (`27ca962`)
- feat: Update workspace package manager declarations (#13154)
(`f878719`)

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.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