Skip to content

Run wd_cc_benchmark() benchmarks once under bazel test - #8545

Merged
mikea merged 1 commit into
mainfrom
maizatskyi/2026-11-17-bench-dry-run
Nov 18, 2026
Merged

mikea merged 1 commit into
mainfrom
maizatskyi/2026-11-17-bench-dry-run

Conversation

@mikea

@mikea mikea commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

wd_cc_benchmark() executables are cc_tests, so bazel test //... runs them, and until now they measured every benchmark as bazel run does, which takes long and checks nothing more.

They now get their own main() (//src/workerd/tests:bench-main), which is Google Benchmark's, except that under bazel test it adds --benchmark_dry_run=true, so that the test runs each benchmark once, to check that it works, and measures nothing. It tells bazel test from bazel run by the environment: both set TEST_SRCDIR, and only bazel run sets BUILD_WORKSPACE_DIRECTORY (the cc_test env attribute would apply to bazel run too). The flag goes before the command line's, so that those override it. bazel run, and so CodSpeed, still measures.

recordAllocationStats() does nothing in a dry run, which measures nothing.

@mikea
mikea requested review from a team as code owners November 17, 2026 17:11

@clanky-the-clanker clanky-the-clanker Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Superseded by the review of 4d92e7cd.

This review, of 699b6fd2

✅ Approved — Small, correct change to benchmark test infrastructure with no issues found.

The decision is advisory: this review is a comment and never approves, blocks or requests changes on the pull request.


✅ All checks passed

📋 Code Quality: ✅ LGTM

The environment check, the order of the arguments and the dry-run early return in recordAllocationStats() all look correct.


📝 Documentation: ✅ LGTM

The updates to docs/benchmarking.md and build/AGENTS.md describe the new behaviour accurately.


Reviewed commit: 699b6fd2

@mikea
mikea enabled auto-merge November 18, 2026 16:31
wd_cc_benchmark() executables are cc_tests, so `bazel test //...`
runs them, and until now they measured every benchmark as `bazel run`
does, which takes long and checks nothing more.

They now get their own main() (//src/workerd/tests:bench-main), which
is Google Benchmark's, except that under `bazel test` it adds
--benchmark_dry_run=true, so that the test runs each benchmark once,
to check that it works, and measures nothing. It tells `bazel test`
from `bazel run` by the environment: both set TEST_SRCDIR, and only
`bazel run` sets BUILD_WORKSPACE_DIRECTORY (the cc_test env attribute
would apply to `bazel run` too). The flag goes before the command
line's, so that those override it. `bazel run`, and so CodSpeed, still
measures.

recordAllocationStats() does nothing in a dry run, which measures
nothing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mikea
mikea force-pushed the maizatskyi/2026-11-17-bench-dry-run branch from 699b6fd to 4d92e7c Compare November 18, 2026 17:59

@clanky-the-clanker clanky-the-clanker Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ Approved — Small, correct change to benchmark test infrastructure with no issues found.

The decision is advisory: this review is a comment and never approves, blocks or requests changes on the pull request.


✅ All checks passed

📋 Code Quality: ✅ LGTM

The environment check, the order of the arguments and the dry-run early return in recordAllocationStats() all look correct.


📝 Documentation: ✅ LGTM

The updates to docs/benchmarking.md and build/AGENTS.md describe the new behaviour accurately.


Reviewed commit: 4d92e7cd — same changes as 699b6fd2, so this is that commit's review (no new review was run; line numbers are as of 699b6fd2)

@mikea
mikea merged commit 6aa6e7c into main Nov 18, 2026
23 checks passed
@mikea
mikea deleted the maizatskyi/2026-11-17-bench-dry-run branch November 18, 2026 18:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants