Skip to content

chore(bench): move specifier allocation out of the timed symlink loop#1270

Merged
Boshen merged 1 commit into
mainfrom
chore/bench-symlink-specifiers
Jul 2, 2026
Merged

chore(bench): move specifier allocation out of the timed symlink loop#1270
Boshen merged 1 commit into
mainfrom
chore/bench-symlink-specifiers

Conversation

@Boshen

@Boshen Boshen commented Jul 2, 2026

Copy link
Copy Markdown
Member

The two "resolve from symlinks" benches did, per timed iteration, 10,000 eager format!("./file{i}") allocations plus an assert!(.. .is_ok()) branch — unlike every sibling bench in the file, which iterates precomputed data and discards results with _ =. The asserts also re-checked an invariant already validated once before the benchmark group runs.

This precomputes the specifiers once (mirroring the find tsconfig bench's hoisting pattern) and drops the in-loop asserts, so the benches measure symlink resolution rather than resolution + allocation noise. The validation pass also now constructs one resolver instead of 10,000.

Heads-up: this will step-change the CodSpeed series for resolver_memory/resolve from symlinks and resolver_real/resolve from symlinks downward — that's the removed allocation/assert overhead, not a resolver perf change.

Part of a second cleanup pass; follows #1264#1268.

The two "resolve from symlinks" benches allocated 10k `format!`
strings and ran an `assert!` branch inside the timed body, unlike the
sibling benches which iterate precomputed data and discard results.
Precompute the specifiers once (also reusing a single resolver for the
pre-bench validation pass instead of constructing 10k of them).

Note: this removes allocation noise from the measurement, so the
CodSpeed series for resolver_memory/resolve-from-symlinks and
resolver_real/resolve-from-symlinks will step down.
@codspeed-hq

codspeed-hq Bot commented Jul 2, 2026

Copy link
Copy Markdown

Merging this PR will improve performance by 4.08%

⚠️ Different runtime environments detected

Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.

Open the report in CodSpeed to investigate

⚡ 4 improved benchmarks
❌ 1 regressed benchmark
✅ 16 untouched benchmarks
⏩ 5 skipped benchmarks1

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Benchmark BASE HEAD Efficiency
pm/pnpm-isolated 1 ms 1.1 ms -5.3%
resolver_memory[resolve from symlinks] 25.7 ms 23.5 ms +9.21%
resolver_real[resolve from symlinks] 25.6 ms 23.6 ms +8.58%
pm/bun-isolated 1.1 ms 1 ms +4.58%
pm/yarn-flat 992.1 µs 954 µs +3.99%

Tip

Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.


Comparing chore/bench-symlink-specifiers (a000405) with main (0fbd4a3)

Open in CodSpeed

Footnotes

  1. 5 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@Boshen
Boshen merged commit a042d49 into main Jul 2, 2026
13 checks passed
@Boshen
Boshen deleted the chore/bench-symlink-specifiers branch July 2, 2026 08:31
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