Skip to content

fix(vitest-plugin): prefix walltime URIs of top-level benches with the file path - #103

Open
not-matthias wants to merge 1 commit into
mainfrom
cod-3984-fix-vitest-top-level-bench-uri
Open

not-matthias wants to merge 1 commit into
mainfrom
cod-3984-fix-vitest-top-level-bench-uri

Conversation

@not-matthias

Copy link
Copy Markdown
Member

In walltime mode with Vitest 3 and 4, a bench declared outside a describe block reports ::<name> to the runner, while its results use <file>::<name>. The profile and the results end up under different URIs, so the benchmark gets no flamegraph.

WalltimeRunner.populateBenchmarkUris registered URI prefixes for nested suites only. A top-level bench belongs to the root file suite, so the prefix lookup returned an empty string. The root suite is now registered with the file path. Nested suites keep the same prefixes as before.

The new walltime.test.ts runs a top-level bench and a nested bench through the runner and checks the URIs passed to setExecutedBenchmark. Without the fix it gets ::top-level bench. The Vitest 3 and 4 examples also get a top-level bench, so CI covers this case.

The Vitest 5 provider builds its URIs from the test's file path and was not affected.

Refs COD-3984

…e file path

The walltime runner only registered URI prefixes for nested suites, so a
bench declared outside a `describe` block reported `::<name>` to the
runner while its results used `<file>::<name>`. The profile and results
URIs then no longer matched and the benchmark had no flamegraph.

Register the root file suite too, and add a top-level bench to the
Vitest 3 and 4 examples.

Refs COD-3984
@codspeed

codspeed Bot commented Oct 23, 2026

Copy link
Copy Markdown

Merging this PR will regress 7 benchmarks

3 warnings, 1 note

⚠️ Walltime results may be unreliable

Some benchmarks used the Walltime instrument outside CodSpeed Macro Runners, which can make the results inconsistent.

Learn more about Macro Runners

See affected benchmarks

⚠️ 14 benchmarks are dominated by system calls

System calls cannot be simulated consistently and are left out of the measure. The reported value understates the real cost. Switch to the Walltime instrument to measure them.

Learn more about system calls

See affected benchmarks

⚠️ Base and head ran on different runner types

Some benchmarks with significant performance changes were compared across different runner types, so the changes might not come from the code. Run base and head on the same runner type, or use CodSpeed Macro Runners for more stable results.

Learn more about Macro Runners

Open the report in CodSpeed to investigate

ℹ️ 25 benchmarks have no flamegraph

The flamegraph wasn't generated: most of the time was spent in runtime internals, which would leave nothing useful to analyze.

See affected benchmarks

⚡ 14 improved benchmarks
❌ 7 regressed benchmarks
✅ 243 untouched benchmarks
🆕 6 new benchmarks
⏩ 56 skipped benchmarks1

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
❌ Walltime short body 1.6 µs 1.9 µs -14.91%
❌ Walltime short body 1.6 µs 1.9 µs -14.37%
❌ Walltime switch 2 84 ns 96 ns -12.5%
❌ Walltime short body 1.7 µs 1.9 µs -12.42%
❌ Walltime short body 1.6 µs 1.9 µs -12.26%
❌ CPU Simulation iterative fibo 20 26 µs 29.6 µs -12.11%
❌ Walltime short body 1.7 µs 1.9 µs -11.25%
⚡ CPU Simulation wait 500ms 47.9 ms 28 ms +71.5%
⚡ CPU Simulation short body 243.8 µs 155.1 µs +57.17%
⚡ CPU Simulation short body 243.6 µs 155 µs +57.11%
⚡ CPU Simulation wait 1sec 83.7 ms 56.2 ms +48.76%
⚡ CPU Simulation wait 500ms 47.1 ms 36.3 ms +29.84%
⚡ Walltime test sync baz 10 144 ns 120 ns +20%
⚡ CPU Simulation wait 1sec 85.1 ms 71.7 ms +18.64%
⚡ CPU Simulation long body 640.8 µs 549.7 µs +16.58%
⚡ CPU Simulation long body 640.7 µs 550 µs +16.5%
⚡ Walltime switch 2 96 ns 84 ns +14.29%
⚡ Walltime test_recursive_cached_fibo_10 2.5 µs 2.2 µs +13.98%
⚡ Walltime switch 2 108 ns 96 ns +12.5%
⚡ Walltime test sync baz 100 240 ns 216 ns +11.11%
... ... ... ... ... ...

ℹ️ Only the first 20 benchmarks are displayed. Go to the app to view all benchmarks.

Tip

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


Comparing cod-3984-fix-vitest-top-level-bench-uri (7208f24) with main (d15b97d)

Open in CodSpeed

Footnotes

  1. 56 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. ↩

@not-matthias
not-matthias marked this pull request as ready for review October 23, 2026 13:07
@greptile-apps

greptile-apps Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge.

Summary

Fixes missing file prefixes for top-level benchmark markers in Vitest 3 and 4 walltime runs.

  • Top-level walltime benches use their file path in profile URIs.

No actionable issues found. Tests were not run.

Reviews (1) · Last reviewed commit: "fix(vitest-plugin): prefix walltime URIs..." · Reviewed by Greptile

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