perf: Reuse input hashes and trim pnpm lockfile allocations (#12199)
## Summary
- reuse repo-index blob OIDs for clean tracked files matched by explicit
`inputs`, including parent-path matches, instead of sending them back
through `hash_objects`
- reuse the same repo-index split for explicit include literals/globs in
the mixed default-plus-input path
- reduce pnpm lockfile parser allocator churn by preallocating the
dependency index and combined snapshot dependency maps
- document the explicit-input repo-index reuse in `ARCHITECTURE.md`
## Verification
- `cargo fmt --all`
- `cargo test -p turborepo-scm package_deps::tests`
- `cargo test -p turborepo-scm repo_index::tests`
- `cargo test -p turborepo-scm
git_index_regression_tests::test_inputs_without_defaults_match_no_index_for_tracked_and_parent_files`
- `cargo test -p turborepo-lockfiles pnpm`
- `cargo test -p turborepo-repository package_manager`
- `cargo check -p turborepo-lockfiles -p turborepo-repository -p
turborepo-scm -p turborepo-task-hash -p turborepo-lib`
- `cargo build --profile release-turborepo -p turbo`
## Profiling
Release benchmark command:
`target/release-turborepo/turbo run build --filter=@turbo/cli
--skip-infer --force --profile=... --ui=stream`
Because the child `cargo build --package turbo` hits a nightly
incremental compiler ICE on this machine, the warm post-change benchmark
runs used `CARGO_INCREMENTAL=0` to keep the task execution path stable.
The Turbo-owned hashing and lockfile work measured here happens before
the child build and is unaffected by that setting.
Saved baseline trace before this PR:
- duration: `934.0ms`
- `hash_scope`: `13.2ms`
- `get_package_file_hashes_from_inputs`: `13.0ms` total
- `hash_objects`: `4.5ms`
- `parse_lockfile`: `18.6ms`
Post-change warm traces:
- `pr3-after-lockfile-warm.trace.md`: duration `815.0ms`,
`get_package_file_hashes_from_inputs` `9.3ms`, `parse_lockfile` `14.6ms`
- `pr3-after-lockfile-warm-2.trace.md`: duration `766.5ms`,
`get_package_file_hashes_from_inputs` `7.9ms`, `parse_lockfile` `16.7ms`
- `hash_objects` no longer appears in the warm hotspot table after the
explicit-input hashing change