|
1 | 1 | import { writeFileSync } from "fs"; |
| 2 | +import { getCodspeedRunnerMode } from "."; |
2 | 3 |
|
3 | 4 | const CUSTOM_INTROSPECTION_EXIT_CODE = 0; |
4 | 5 |
|
5 | 6 | export const getV8Flags = () => { |
6 | 7 | const nodeVersionMajor = parseInt(process.version.slice(1).split(".")[0]); |
| 8 | + const codspeedRunnerMode = getCodspeedRunnerMode(); |
7 | 9 |
|
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 | + } |
25 | 31 | } |
| 32 | + |
26 | 33 | return flags; |
27 | 34 | }; |
28 | 35 |
|
|
0 commit comments