Repository navigation
fix(bench): load benchmark sources as file URLs so they run on Windows - #27621
Conversation
`await import(path.join(ROOT, '...ts'))` hands Node a bare Windows path
(`C:\...`), which the ESM loader rejects as an unsupported URL scheme
("Received protocol 'c:'"). The two benchmarks that load production
modules this way crashed on Windows before running a single scenario,
while working on macOS and Linux where an absolute path is a valid
specifier.
Wrap each computed specifier in `pathToFileURL(...).href`, the form the
other benchmark scripts already use for the same purpose.
Verified on Windows: bench:session-write-hot-path and
bench:agent-inspection-cadence now run and print their measurement
tables. The fish mode-2031 trace capture resolves its import too, but its
harness targets macOS/Linux shells and cannot complete on Windows.
Fixes #25235
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ⬇️ Low Merge Risk: ⚪ Minimal · up to The reported Windows import failure is addressed by passing file URLs to the dynamic imports. The supplied context identifies no remaining merge-blocking risk. Pre-merge checks |
|
ELI5
Two of Orca's speed tests crashed on Windows before measuring anything. They now run.
What Changed
bench:session-write-hot-pathandbench:agent-inspection-cadenceload TypeScript sources withawait import(path.join(...)). On Windows that path starts withC:\, which Node reads as a URL scheme, so both exited withERR_UNSUPPORTED_ESM_URL_SCHEME. They now passpathToFileURL(...).href. The fish mode-2031 trace script had the same pattern and gets the same fix.Why
A file URL is the form Node requires for dynamic import on Windows, and it's what other benchmarks in the repo already use. Without these benchmarks, Windows performance fixes can't be measured.
This is @paoValle's fix from #25237, cherry-picked with authorship kept. They closed that PR only to cut down their open PRs, not because anything was wrong with it. The only addition is an
oxfmtre-wrap of one line.Linked Issue
Refs #25235: this fixes the import crash. The idle-CPU part is in a separate PR.
Visual Proof
N/A: these are command-line benchmark scripts with no UI.
Testing
On Windows 11:
Before (main): both commands exit 1 with
ERR_UNSUPPORTED_ESM_URL_SCHEME.After: both exit 0 and print their tables, e.g. scrollback scan 15.7 ms → 2.9 ms, and 8 panes 84 → 32 inspections.
oxlint,oxfmt --checkandcheck:code-quality:changedare clean.The fish script was only syntax-checked, because its harness needs a POSIX shell.
I manually tested these changes locally
Automated tests added/updated, or explained why not below: these are benchmark scripts; running them is the test.
Checklist
N/Awith reasonpathToFileURLis correct on every platform