Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions resources/benchmark.ts
Original file line number Diff line number Diff line change
Expand Up @@ -381,9 +381,12 @@ function sampleModule(modulePath: string): BenchmarkSample {

const sampleCode = `
import fs from 'node:fs';
import os from 'node:os';

import { benchmark } from '${moduleURL}';

os.setPriority(os.constants.priority.PRIORITY_HIGHEST);

// warm up, it looks like 7 is a magic number to reliably trigger JIT
benchmark.measure();
benchmark.measure();
Expand Down Expand Up @@ -414,8 +417,10 @@ function sampleModule(modulePath: string): BenchmarkSample {
`;

const result = cp.spawnSync(
process.execPath,
'sudo',
[
'--close-from=4',
`"${process.execPath}"`,
// V8 flags
'--predictable',
'--no-concurrent-sweeping',
Expand All @@ -427,9 +432,10 @@ function sampleModule(modulePath: string): BenchmarkSample {
// Node.js flags
'--input-type=module',
'--eval',
sampleCode,
`"${sampleCode}"`,
],
{
shell: true,
stdio: ['inherit', 'inherit', 'inherit', 'pipe'],
env: { NODE_ENV: 'production' },
},
Expand Down