Skip to content

Commit d3a13f8

Browse files
committed
benchmark: increase process priority
to try to avoid involuntary context switches
1 parent e54ed90 commit d3a13f8

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

.github/workflows/cmd-run-benchmark.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333

3434
- name: Run Benchmark
3535
run: |
36-
npm run benchmark -- --revs HEAD BASE
36+
sudo npm run benchmark -- --revs HEAD BASE
3737
3838
- name: Create replyMessage
3939
uses: actions/github-script@v6

resources/benchmark.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,9 +381,12 @@ function sampleModule(modulePath: string): BenchmarkSample {
381381

382382
const sampleCode = `
383383
import fs from 'node:fs';
384+
import os from 'node:os';
384385
385386
import { benchmark } from '${moduleURL}';
386387
388+
os.setPriority(os.constants.priority.PRIORITY_HIGHEST);
389+
387390
// warm up, it looks like 7 is a magic number to reliably trigger JIT
388391
benchmark.measure();
389392
benchmark.measure();

0 commit comments

Comments
 (0)