Skip to content

Commit a554e4a

Browse files
Mossakaclaude
andauthored
perf: use --build-local in benchmarks to test source code changes (#1872)
The benchmark previously pulled pre-built GHCR images, meaning changes to container files (entrypoint.sh, Dockerfiles) had no effect on results until a new release published updated images. PR #1851's sleep 5 fix showed zero improvement for this reason. Changes: - Add --build-local to AWF_CMD so containers are built from source - Cold start now clears Docker build cache instead of removing GHCR images - Include awf-iptables-init in cleanup for completeness Closes #1869 Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 7258a16 commit a554e4a

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

scripts/ci/benchmark-performance.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ import { stats, parseMb, checkRegressions, BenchmarkResult, BenchmarkReport } fr
2121
// ── Configuration ──────────────────────────────────────────────────
2222

2323
const ITERATIONS = parseInt(process.env.AWF_BENCHMARK_ITERATIONS || '30', 10);
24-
const AWF_CMD = "sudo awf";
24+
const AWF_CMD = "sudo awf --build-local";
2525
const ALLOWED_DOMAIN = "api.github.com";
26-
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";
26+
const CLEANUP_CMD = "sudo docker compose down -v 2>/dev/null; sudo docker rm -f awf-squid awf-agent awf-iptables-init 2>/dev/null; sudo docker network prune -f 2>/dev/null";
2727

2828
// ── Thresholds (milliseconds or MB) ───────────────────────────────
2929

@@ -63,9 +63,9 @@ function benchmarkColdStart(): BenchmarkResult {
6363

6464
for (let i = 0; i < ITERATIONS; i++) {
6565
cleanup();
66-
// Remove cached images to force cold pull
66+
// Remove locally-built images and build cache to force a full rebuild
6767
try {
68-
execSync("sudo docker rmi ghcr.io/github/gh-aw-firewall/squid:latest ghcr.io/github/gh-aw-firewall/agent:latest 2>/dev/null", { stdio: "ignore", timeout: 30_000 });
68+
execSync("sudo docker image prune -af --filter 'label=com.docker.compose.project' 2>/dev/null; sudo docker builder prune -af 2>/dev/null", { stdio: "ignore", timeout: 60_000 });
6969
} catch {
7070
// images may not exist
7171
}

0 commit comments

Comments
 (0)