Conversation
Return DefaultInfo from cc_binary_impl for cc_binary and append it directly. Keep the existing struct for cc_test, whose runner callback needs its executable and runfiles. In nine paired analysis-only runs over 4,000 cc_binary targets on Bazel 9.2, median analysis time was 2.45 s before and 2.35 s after; the runs varied and phase-end heap did not improve. The change removes one temporary struct per cc_binary. Validated with buildifier and 70 cc_binary/linkstamp analysis tests.
Have the bundled cc_test runner opt in to receiving DefaultInfo from cc_binary_impl and return that provider directly. Preserve the struct argument for legacy cc_test and custom runners that do not opt in. Name the cc_binary provider default_info at the append site. The runfiles and configured-target suites passed (63 tests); an unmarked custom runner also received the struct and passed. Buildifier passed. In two paired JFR analysis runs over 2,000 cc_test targets, Java allocation was 2018/2004 MiB and 2071/2121 MiB (baseline/changed). Phase-end heap was 73.64/73.58 and 74.17/74.19 MiB. These runs do not establish a measurable memory reduction.
Bazel 7 and 8 load their own cc_binary_impl from virtual builtins and pass a struct to the bundled default test runner. Convert that struct to DefaultInfo for those versions; reuse DefaultInfo directly when cc_binary_impl supplies one. Reproduced the Buildkite executable/DefaultInfo analysis failure on Bazel 7.7.1. The failing target now analyzes on Bazel 7.7.1 and Bazel 8.2.1; 63 affected tests pass on Bazel 9.2.0. Buildifier and git diff --check pass.
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.
Return DefaultInfo from cc_binary_impl for cc_binary and non-legacy cc_test. Keep the existing struct for legacy cc_tes and new cc_test where non-custom runner needs its executable and runfiles.
In nine paired analysis-only runs over 4,000 cc_binary targets on Bazel 9.2, median analysis time was 2.45 s before and 2.35 s after. The change removes one temporary struct per cc_binary.