Skip to content

Commit 51ddd25

Browse files
committed
benchmark: increase process priority
to try to avoid involuntary context switches
1 parent 385597e commit 51ddd25

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

resources/benchmark.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -376,9 +376,12 @@ interface BenchmarkSample {
376376
function sampleModule(modulePath: string): BenchmarkSample {
377377
const sampleCode = `
378378
import fs from 'node:fs';
379+
import os from 'node:os';
379380
380381
import { benchmark } from '${modulePath}';
381382
383+
os.setPriority(os.constants.priority.PRIORITY_HIGHEST);
384+
382385
// warm up, it looks like 7 is a magic number to reliably trigger JIT
383386
benchmark.measure();
384387
benchmark.measure();

0 commit comments

Comments
 (0)