Skip to content

Commit 8d7e196

Browse files
fix(core): be minimalistic about walltime node flags
1 parent ee01e40 commit 8d7e196

File tree

2 files changed

+26
-19
lines changed

2 files changed

+26
-19
lines changed

packages/core/src/introspection.ts

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,35 @@
11
import { writeFileSync } from "fs";
2+
import { getCodspeedRunnerMode } from ".";
23

34
const CUSTOM_INTROSPECTION_EXIT_CODE = 0;
45

56
export const getV8Flags = () => {
67
const nodeVersionMajor = parseInt(process.version.slice(1).split(".")[0]);
8+
const codspeedRunnerMode = getCodspeedRunnerMode();
79

8-
const flags = [
9-
"--hash-seed=1",
10-
"--random-seed=1",
11-
"--no-opt",
12-
"--predictable",
13-
"--predictable-gc-schedule",
14-
"--interpreted-frames-native-stack",
15-
"--allow-natives-syntax",
16-
"--expose-gc",
17-
"--no-concurrent-sweeping",
18-
"--max-old-space-size=4096",
19-
];
20-
if (nodeVersionMajor < 18) {
21-
flags.push("--no-randomize-hashes");
22-
}
23-
if (nodeVersionMajor < 20) {
24-
flags.push("--no-scavenge-task");
10+
const flags = ["--interpreted-frames-native-stack", "--allow-natives-syntax"];
11+
12+
if (codspeedRunnerMode === "instrumented") {
13+
flags.push(
14+
...[
15+
"--hash-seed=1",
16+
"--random-seed=1",
17+
"--no-opt",
18+
"--predictable",
19+
"--predictable-gc-schedule",
20+
"--expose-gc",
21+
"--no-concurrent-sweeping",
22+
"--max-old-space-size=4096",
23+
]
24+
);
25+
if (nodeVersionMajor < 18) {
26+
flags.push("--no-randomize-hashes");
27+
}
28+
if (nodeVersionMajor < 20) {
29+
flags.push("--no-scavenge-task");
30+
}
2531
}
32+
2633
return flags;
2734
};
2835

packages/vitest-plugin/src/__tests__/index.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,13 +93,13 @@ describe("codSpeedPlugin", () => {
9393
poolOptions: {
9494
forks: {
9595
execArgv: [
96+
"--interpreted-frames-native-stack",
97+
"--allow-natives-syntax",
9698
"--hash-seed=1",
9799
"--random-seed=1",
98100
"--no-opt",
99101
"--predictable",
100102
"--predictable-gc-schedule",
101-
"--interpreted-frames-native-stack",
102-
"--allow-natives-syntax",
103103
"--expose-gc",
104104
"--no-concurrent-sweeping",
105105
"--max-old-space-size=4096",

0 commit comments

Comments
 (0)