Skip to content

Commit 57937b9

Browse files
committed
support async benchmark tests
1 parent 4f8864e commit 57937b9

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

resources/benchmark.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -379,20 +379,20 @@ function sampleModule(modulePath: string): BenchmarkSample {
379379
import { benchmark } from '${modulePath}';
380380
381381
// warm up, it looks like 7 is a magic number to reliably trigger JIT
382-
benchmark.measure();
383-
benchmark.measure();
384-
benchmark.measure();
385-
benchmark.measure();
386-
benchmark.measure();
387-
benchmark.measure();
388-
benchmark.measure();
382+
await benchmark.measure();
383+
await benchmark.measure();
384+
await benchmark.measure();
385+
await benchmark.measure();
386+
await benchmark.measure();
387+
await benchmark.measure();
388+
await benchmark.measure();
389389
390390
const memBaseline = process.memoryUsage().heapUsed;
391391
392392
const resourcesStart = process.resourceUsage();
393393
const startTime = process.hrtime.bigint();
394394
for (let i = 0; i < benchmark.count; ++i) {
395-
benchmark.measure();
395+
await benchmark.measure();
396396
}
397397
const timeDiff = Number(process.hrtime.bigint() - startTime);
398398
const resourcesEnd = process.resourceUsage();

0 commit comments

Comments
 (0)