Skip to content

Torture bazel benchmark#121

Merged
brianmcgee merged 2 commits intomainfrom
torture-bazel-benchmark
Apr 15, 2026
Merged

Torture bazel benchmark#121
brianmcgee merged 2 commits intomainfrom
torture-bazel-benchmark

Conversation

@brianmcgee
Copy link
Copy Markdown
Member

Adds bazel to bench-incremental for comparison.

Also updates nixpkgs input to bring in nix 2.34.5.

Introduce a side-by-side Bazel vs Nix incremental rebuild benchmark on
the torture fixture (14-module Go monorepo, ~497 third-party deps).

Benchmark tool interface
------------------------
Extract a buildTool interface (Name/Build/Cleanup) so the harness can
compare arbitrary build systems on equal footing.  nixTool implements
it as before; a new bazelTool drives Bazel in two phases — loading +
analysis (analogous to nix-instantiate) then execution (nix-store
--realise) — and reports action counts from Bazel's INFO summary line.

Nix setup is now skipped entirely when only non-Nix tools are
requested, saving ~30 s of cold resolution time on bazel-only runs.

Bazel workspace for torture-project
------------------------------------
Add a complete bzlmod workspace so Bazel can build the fixture:

  MODULE.bazel        rules_go 0.60.0, gazelle 0.42.0, go_sdk.host(),
                      200+ use_repo entries for external Go modules,
                      gazelle_override for etcd proto dirs
  BUILD.bazel         custom gazelle_binary (avoids dev-only
                      bazel_skylib_gazelle_plugin dependency)
  .bazelversion       pins Bazel 7.6.0
  .bazelrc            sandboxed strategy, no remote cache
  go.work / go.work.sum  workspace-level replace directives to resolve
                      version conflicts between conflict-a and conflict-b
  Per-module BUILD.bazel files generated by Gazelle for all 18 modules

The hasBazel flag on fixtureConfig gates bazel availability per
fixture; requesting --tools bazel on a fixture without BUILD files
produces a descriptive error.

Cleanup uses `bazel clean --expunge` before shutdown so read-only
sandbox artifacts that os.RemoveAll cannot delete are removed cleanly.

devshell / flake
-----------------
Add pkgs.bazel_7 to devshell packages and to the bench-incremental
nix run wrapper's makeBinPath so bazel is on PATH in both environments.
Also updated the lock file to ensure we're using nix 2.34.5.
@brianmcgee brianmcgee requested a review from aldoborrero April 15, 2026 15:34
@github-actions
Copy link
Copy Markdown

Benchmark Regression Check

Scenario Tool Base (s) Current (s) Change Drvs (base) Drvs (curr) Status
no_change nix-ca-nocgo 0.67 0.66 -0.9% 0 0 ok
no_change nix-nocgo 0.67 0.66 -1.0% 0 0 ok
leaf-private nix-ca-nocgo 1.88 1.89 +0.5% 2 2 ok
leaf-private nix-nocgo 1.42 1.44 +1.2% 2 2 ok
mid-private nix-ca-nocgo 1.94 1.98 +2.3% 2 2 ok
mid-private nix-nocgo 1.51 1.50 -0.4% 4 4 ok
deep-private nix-ca-nocgo 2.23 2.06 -7.8% 3 3 ok
deep-private nix-nocgo 1.74 1.75 +0.1% 8 8 ok

Baseline: main | Current: f644b8a3c31d2b767ad49c8c66a137a4941ef226

@brianmcgee brianmcgee added this pull request to the merge queue Apr 15, 2026
Merged via the queue into main with commit d119452 Apr 15, 2026
3 checks passed
@brianmcgee brianmcgee deleted the torture-bazel-benchmark branch April 15, 2026 15:59
aldoborrero added a commit that referenced this pull request Apr 16, 2026
The dag-mode plugin sets GOWORK=off (resolve.rs:382); dynamic-mode
resolve.go didn't. With a go.work present, workspace MVS ignores
per-module replace directives, so it may select a version the
per-module lockfile doesn't have. The torture fixture (which gained
go.work in #121 for gazelle) hits this with gin v1.9.1 (replace) vs
v1.12.0 (workspace MVS).

:house: Remote-Dev: homespace
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