Skip to content
Open
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
17 changes: 12 additions & 5 deletions packages/core/src/introspection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@ const CUSTOM_INTROSPECTION_EXIT_CODE = 0;

const V8_LOG_FILENAME_PATTERN = "codspeed-v8-%p.log";

// Fixed seeds so Math.random() and hash table layout match on every run
const getSeedFlags = (nodeVersionMajor: number) => {
const flags = ["--hash-seed=1", "--random-seed=1"];
if (nodeVersionMajor < 18) {
flags.push("--no-randomize-hashes");
}
return flags;
};

export const getV8Flags = () => {
const nodeVersionMajor = parseInt(process.version.slice(1).split(".")[0]);
const instrumentMode = getInstrumentMode();
Expand All @@ -17,8 +26,7 @@ export const getV8Flags = () => {
case "analysis": {
flags.push(
...[
"--hash-seed=1",
"--random-seed=1",
...getSeedFlags(nodeVersionMajor),
"--no-opt",
"--always-sparkplug",
"--predictable",
Expand All @@ -28,9 +36,6 @@ export const getV8Flags = () => {
"--max-old-space-size=4096",
],
);
if (nodeVersionMajor < 18) {
flags.push("--no-randomize-hashes");
}
if (nodeVersionMajor < 20) {
flags.push("--no-scavenge-task");
} else {
Expand All @@ -48,6 +53,8 @@ export const getV8Flags = () => {
}

case "walltime": {
flags.push(...getSeedFlags(nodeVersionMajor));

// Emit the V8 jitdump
flags.push("--perf-prof");

Expand Down
Loading