chore(bench): move specifier allocation out of the timed symlink loop#1270
Merged
Conversation
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.
Merging this PR will improve performance by 4.08%
|
| 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)
Footnotes
-
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. ↩
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.
The two "resolve from symlinks" benches did, per timed iteration, 10,000 eager
format!("./file{i}")allocations plus anassert!(.. .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 tsconfigbench'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 symlinksandresolver_real/resolve from symlinksdownward — that's the removed allocation/assert overhead, not a resolver perf change.Part of a second cleanup pass; follows #1264–#1268.