Repository navigation
perf: skip the repeat bazel mod graph calls once Bzlmod is known to be off - #659
Merged
tinder-maxwellelliott merged 1 commit intoNov 16, 2026
Merged
Conversation
…e off Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KJs3Y1rPVzKVGPi1VhNwUE
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In a workspace with Bzlmod disabled, generate-hashes asked Bazel the same question up to three times. With a MODULE.bazel file present, the run was:
Calls 4 and 6 can only repeat the answer of call 2 (or of call 4 when there is no MODULE.bazel). Each one is a Bazel client start plus a server round trip.
mod graph --output=jsonanswer the survey already has and applies the same success/answered-extension test to it, instead of runningmod graphagain. dump_repo_mapping still decides first, so generate-hashes eagerly evaluates unused transitive Bzlmod module extensions that bazel build //... never loads #531 is unaffected.mod graph --output=jsonin that case. hash_targets (targets handed in directly) still asks.Without MODULE.bazel this saves one Bazel invocation per generate-hashes; with one, two. Bzlmod-enabled workspaces run the same commands as before.
Output is unchanged: hashes, dependency edges and impacted sets are identical on small, medium and large. A new test runs generate-hashes against a fake Bazel with Bzlmod off, with and without MODULE.bazel, and checks that
mod graphruns once and the module graph stays absent.Performance (make perf-proof, base 66fcee3 vs this branch, cargo --release on both sides, small + medium + large, 5 interleaved iterations): IMPROVED, no regressions.
The saving is a fixed ~25-35 ms of client CPU per generate-hashes, so it shows most on small workspaces; medium and large move the same direction but stay under significance at n=5. Peak RSS and get-impacted-targets are unchanged.
Test environment: the benchmark sandbox cannot reach bcr.bazel.build, so the measured workspaces ran through a wrapper that adds --noenable_bzlmod --enable_workspace to every command and execs the Bazel 8.8.2 client directly (no bazelisk in between, so client start-up is not inflated). Both sides ran with the same wrapper. That is also the configuration this change targets.
Tests: cargo test --release --lib, 299 pass (the 10 server remote-cache and GCS tests were skipped: they need network the sandbox does not have and do not touch this code). rustfmt --check is clean.
🤖 Generated with Claude Code