Skip to content

Commit f75cc49

Browse files
committed
Add comment on why we need url.pathToFileURL
1 parent 94fd41d commit f75cc49

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

resources/benchmark.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,10 +376,13 @@ interface BenchmarkSample {
376376
}
377377

378378
function sampleModule(modulePath: string): BenchmarkSample {
379+
// To support Windows we need to use URL instead of path
380+
const moduleURL = url.pathToFileURL(modulePath);
381+
379382
const sampleCode = `
380383
import fs from 'node:fs';
381384
382-
import { benchmark } from '${url.pathToFileURL(modulePath)}';
385+
import { benchmark } from '${moduleURL}';
383386
384387
// warm up, it looks like 7 is a magic number to reliably trigger JIT
385388
benchmark.measure();

0 commit comments

Comments
 (0)