perf: Skip unused repository indexing for package listings (#13792)
## Summary
Avoid building the tracked Git index, scanning untracked files, and
calculating unused cache SCM provenance for `turbo ls`. The listing path
keeps its SCM handle so `--affected` and Git-based filters continue to
work; all other `RunBuilder` callers retain the existing behavior.
## Models
- Author: `openai/gpt-5.6-sol`
- Opposite-model reviewer: `anthropic/claude-fable-5`
(`fable_performance_reviewer`)
## Hypothesis
`turbo ls` does not hash files, execute tasks, or use cache provenance,
so its eager repository index and dirty-state work is unnecessary.
Removing that work only from the listing path should reduce warm
end-to-end latency and filesystem syscalls without changing output or
affected filtering.
## Methodology
- Built and preserved baseline and candidate with `cargo build --profile
release-turborepo -p turbo`.
- Baseline SHA-256:
`5a29b912b6f4790eb95dd8f66426335f29b5500140d68ebd6327dc6c918a630e`.
- Candidate SHA-256:
`37812f33869d97c8fd51361b46110e5f88bd5883dce4d04b5a347e4f12701cdc`.
- Both binaries: 50,462,240 bytes.
- Timed warm `turbo ls --output=json` with telemetry disabled and output
redirected.
- Used 3 warmups and 20 measurements per binary per corpus, split into
four balanced AB/BA blocks.
- Bootstrapped the four block-level median speedups with 100,000
resamples; no samples were excluded.
- Corpora: create-t3-turbo `8f945b7` (13 packages), Payload `24ac895`
(52), and Turborepo `0cfccdd8` (86).
- Environment: Linux x86_64, 2-vCPU Intel Xeon 2.90 GHz, 4.2 GiB RAM,
Rust nightly 2026-05-22, hyperfine 1.19.0.
## Results
The clean-checkout Payload command improved from **58.0 ± 8.1 ms** to
**34.2 ± 1.5 ms** across 20 runs.
Balanced block results:
| Corpus | Mean block speedup | 95% bootstrap CI |
| --- | ---: | ---: |
| create-t3-turbo | 10.86% | [7.50%, 13.32%] |
| Payload | 42.82% | [34.07%, 54.43%] |
| Turborepo | 12.73% | [7.55%, 17.90%] |
Every block improved in both command orders. The claim is limited to
warm-state `turbo ls`.
`strace -f -c` on Payload corroborated the mechanism:
- total syscalls: 19,052 → 3,748
- `newfstatat`: 8,897 → 3
- `getdents64`: 2,261 → 4
- `openat`: 1,564 → 313
- `fstat`: 1,162 → 15
The strace timing itself is diagnostic and is not used for the
wall-clock claim.
## Correctness
- `cargo test -p turbo --test command_ls_test` — 5 passed
- `cargo test -p turbo --test affected_test` — 32 passed, including
affected listing/filter coverage
- `cargo clippy -p turborepo-lib --all-targets -- -D warnings` — passed
- Final release build — passed
- `git diff --check` — passed
- Baseline/candidate JSON was byte-identical across all three corpora,
the dirty local checkout, and Payload with an injected untracked file.
## Review
The opposite-model reviewer approved the exact final diff with no
blocking findings. It found the timing evidence, syscall corroboration,
output equivalence, and affected-filter coverage sufficient.
Non-blocking limitations were the noisy 2-vCPU environment and the
warm-state-only scope.
Co-authored-by: vercel-gh-bot-4[bot] <312518292+vercel-gh-bot-4[bot]@users.noreply.github.com>