Skip to content

Skip transition machinery for config.none() attributes - #31830

Closed
fmeum wants to merge 1 commit into
bazelbuild:masterfrom
fmeum:noconfig-transition-shortcut
Closed

fmeum wants to merge 1 commit into
bazelbuild:masterfrom
fmeum:noconfig-transition-shortcut

Conversation

@fmeum

@fmeum fmeum commented Oct 17, 2026 •

Copy link
Copy Markdown
Collaborator

Description

NoConfigTransition always produces the empty configuration, regardless of the parent configuration. DependencyProducer now uses its configuration key directly instead of restricting the parent options, applying the transition and running BuildConfigurationKeyProducer for every dependency edge through a config.none() attribute.

Motivation

Every rule has a package_metadata attribute with cfg = config.none() that is populated from default_package_metadata in package() or repo(), so each label in that list goes through this path once per configured target.

Benchmark: 20,000 trivial Starlark targets with default_package_metadata set in REPO.bazel, analyzed with bazel build --nobuild //.... Each number is the median server CPU time of 32 full reanalyses (forced by changing --define) across 4 server restarts, interleaved between binaries, on a 16-core M3 Max. The interquartile range is in brackets.

labels CPU before CPU after
0 2.06 s [1.89–2.21] 1.95 s [1.84–2.16]
3 2.53 s [2.34–2.81] 2.42 s [2.20–2.61]

With three labels, the difference is within noise: it is the same as without any labels, where this change has no effect. In an earlier run with 50 labels, CPU time went from 4.35 s to 4.06 s, which is about 0.3 of the 2.6 µs that each label costs per configured target. The Skyframe graph is unchanged.

Build API Changes

No

Release Notes

RELNOTES: None

`NoConfigTransition` always yields the empty configuration, so there is
no need to restrict the parent options, run the transition, and go
through `BuildConfigurationKeyProducer` for each dependency edge. Every
rule has a `package_metadata` attribute that uses `config.none()`, so
this applies to each label in `default_package_metadata` for every
configured target.
@fmeum fmeum closed this Oct 17, 2026
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.

1 participant