Skip to content
Merged
Show file tree
Hide file tree
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
6 changes: 4 additions & 2 deletions .github/workflows/performance-monitor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
iterations:
description: "Number of iterations per metric"
required: false
default: "5"
default: "30"

permissions:
contents: read
Expand All @@ -19,7 +19,7 @@ jobs:
benchmark:
name: Run Performance Benchmarks
runs-on: ubuntu-latest
timeout-minutes: 30
timeout-minutes: 90
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -46,6 +46,8 @@ jobs:

- name: Run benchmarks
id: benchmark
env:
AWF_BENCHMARK_ITERATIONS: ${{ github.event.inputs.iterations || '30' }}
run: |
npx tsx scripts/ci/benchmark-performance.ts > benchmark-results.json 2>benchmark-progress.log || true
cat benchmark-progress.log
Expand Down
2 changes: 1 addition & 1 deletion scripts/ci/benchmark-performance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { stats, parseMb, checkRegressions, BenchmarkResult, BenchmarkReport } fr

// ── Configuration ──────────────────────────────────────────────────

const ITERATIONS = 5;
const ITERATIONS = parseInt(process.env.AWF_BENCHMARK_ITERATIONS || '30', 10);
Copy link

Copilot AI Apr 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ITERATIONS is derived directly from AWF_BENCHMARK_ITERATIONS via parseInt(...) with no validation. If the env var is non-numeric (NaN) or <= 0, several benchmarks will produce an empty values array and then stats(values) will throw (stats() requires at least one value). Consider validating/clamping to a positive integer and falling back to the default (e.g., 30) with a clear stderr warning when the input is invalid.

Suggested change
const ITERATIONS = parseInt(process.env.AWF_BENCHMARK_ITERATIONS || '30', 10);
const DEFAULT_ITERATIONS = 30;
function getIterations(): number {
const raw = process.env.AWF_BENCHMARK_ITERATIONS;
if (raw === undefined) {
return DEFAULT_ITERATIONS;
}
const parsed = Number.parseInt(raw, 10);
if (!Number.isInteger(parsed) || parsed <= 0) {
console.error(
`Invalid AWF_BENCHMARK_ITERATIONS=${JSON.stringify(raw)}; using default ${DEFAULT_ITERATIONS}.`
);
return DEFAULT_ITERATIONS;
}
return parsed;
}
const ITERATIONS = getIterations();

Copilot uses AI. Check for mistakes.
const AWF_CMD = "sudo awf";
const ALLOWED_DOMAIN = "api.github.com";
const CLEANUP_CMD = "sudo docker compose down -v 2>/dev/null; sudo docker rm -f awf-squid awf-agent 2>/dev/null; sudo docker network prune -f 2>/dev/null";
Expand Down
Loading