From c3ddfff2dc84d7eecd5d7a42c1a4b262f2f4e0f9 Mon Sep 17 00:00:00 2001 From: Guillaume Lagrange Date: Fri, 19 Sep 2025 11:07:38 +0200 Subject: [PATCH 1/2] ci: re-follow main version for action to use v4 Enables perf by default on walltime runs, and requires explicit mode. --- .github/workflows/ci.yml | 6 ++++-- .github/workflows/codspeed.yml | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 699e530f..720726b7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -62,16 +62,18 @@ jobs: - name: Run benchmarks with tinybench-plugin # use version from `main` branch to always test the latest version, in real projects, use a tag, like `@v2` - uses: CodSpeedHQ/action@v3 + uses: CodSpeedHQ/action@main with: + mode: instrumentation run: pnpm --filter ${{ matrix.example }} bench-tinybench env: CODSPEED_SKIP_UPLOAD: true CODSPEED_DEBUG: true - name: Run benchmarks with benchmark.js-plugin # use version from `main` branch to always test the latest version, in real projects, use a tag, like `@v2` - uses: CodSpeedHQ/action@v3 + uses: CodSpeedHQ/action@main with: + mode: instrumentation run: pnpm --filter ${{ matrix.example }} bench-benchmark-js env: CODSPEED_SKIP_UPLOAD: true diff --git a/.github/workflows/codspeed.yml b/.github/workflows/codspeed.yml index d0c77b2d..9c002e5f 100644 --- a/.github/workflows/codspeed.yml +++ b/.github/workflows/codspeed.yml @@ -25,8 +25,9 @@ jobs: - name: Run benchmarks # use version from `main` branch to always test the latest version, in real projects, use a tag, like `@v2` - uses: CodSpeedHQ/action@v3 + uses: CodSpeedHQ/action@main with: + mode: instrumentation run: | pnpm moon run tinybench-plugin:bench pnpm moon run vitest-plugin:bench @@ -53,8 +54,9 @@ jobs: - name: Run benchmarks # use version from `main` branch to always test the latest version, in real projects, use a tag, like `@v2` - uses: CodSpeedHQ/action@v3 + uses: CodSpeedHQ/action@main with: + mode: walltime run: | pnpm moon run tinybench-plugin:bench pnpm moon run vitest-plugin:bench From 81f0dc9f93de801fe713d4b33c14091686b88eb6 Mon Sep 17 00:00:00 2001 From: Guillaume Lagrange Date: Fri, 19 Sep 2025 11:45:59 +0200 Subject: [PATCH 2/2] fix(core): split node flags to be more minimalistic in walltime These flags will be tweaked in the PR adding proper perf management. --- packages/core/src/introspection.ts | 41 +++++++++++-------- .../vitest-plugin/src/__tests__/index.test.ts | 4 +- 2 files changed, 26 insertions(+), 19 deletions(-) diff --git a/packages/core/src/introspection.ts b/packages/core/src/introspection.ts index 1be58ab1..ce965922 100644 --- a/packages/core/src/introspection.ts +++ b/packages/core/src/introspection.ts @@ -1,28 +1,35 @@ import { writeFileSync } from "fs"; +import { getCodspeedRunnerMode } from "."; const CUSTOM_INTROSPECTION_EXIT_CODE = 0; export const getV8Flags = () => { const nodeVersionMajor = parseInt(process.version.slice(1).split(".")[0]); + const codspeedRunnerMode = getCodspeedRunnerMode(); - const flags = [ - "--hash-seed=1", - "--random-seed=1", - "--no-opt", - "--predictable", - "--predictable-gc-schedule", - "--interpreted-frames-native-stack", - "--allow-natives-syntax", - "--expose-gc", - "--no-concurrent-sweeping", - "--max-old-space-size=4096", - ]; - if (nodeVersionMajor < 18) { - flags.push("--no-randomize-hashes"); - } - if (nodeVersionMajor < 20) { - flags.push("--no-scavenge-task"); + const flags = ["--interpreted-frames-native-stack", "--allow-natives-syntax"]; + + if (codspeedRunnerMode === "instrumented") { + flags.push( + ...[ + "--hash-seed=1", + "--random-seed=1", + "--no-opt", + "--predictable", + "--predictable-gc-schedule", + "--expose-gc", + "--no-concurrent-sweeping", + "--max-old-space-size=4096", + ] + ); + if (nodeVersionMajor < 18) { + flags.push("--no-randomize-hashes"); + } + if (nodeVersionMajor < 20) { + flags.push("--no-scavenge-task"); + } } + return flags; }; diff --git a/packages/vitest-plugin/src/__tests__/index.test.ts b/packages/vitest-plugin/src/__tests__/index.test.ts index 290b0dde..b0322819 100644 --- a/packages/vitest-plugin/src/__tests__/index.test.ts +++ b/packages/vitest-plugin/src/__tests__/index.test.ts @@ -93,13 +93,13 @@ describe("codSpeedPlugin", () => { poolOptions: { forks: { execArgv: [ + "--interpreted-frames-native-stack", + "--allow-natives-syntax", "--hash-seed=1", "--random-seed=1", "--no-opt", "--predictable", "--predictable-gc-schedule", - "--interpreted-frames-native-stack", - "--allow-natives-syntax", "--expose-gc", "--no-concurrent-sweeping", "--max-old-space-size=4096",