Skip to content

Reuse immutable transition attributes - #31199

Open
dzbarsky wants to merge 1 commit into
bazelbuild:masterfrom
dzbarsky:codex/reuse-transition-attributes-upstream
Open

dzbarsky wants to merge 1 commit into
bazelbuild:masterfrom
dzbarsky:codex/reuse-transition-attributes-upstream

Conversation

@dzbarsky

Copy link
Copy Markdown
Contributor

Cache immutable Starlark attribute maps on ConfiguredAttributeMapper and use interned BuildConfigurationKey objects with weak keys and values in the parsed-flags merge cache. In our partial-analysis benchmark on Bazel 9.3, mean analysis time fell from 124.30 to 111.28 seconds (10.5%); reduced GC contributed to the difference.

Validation: targeted Starlark transition and parsed-flags tests passed against master.

RELNOTES: None

-zbarskybot

Cache immutable Starlark attribute values on ConfiguredAttributeMapper for outgoing transitions. Intern ParsedFlagsValue merge-cache keys with BuildConfigurationKey and keep values weak so no-op merges do not retain their keys.

RELNOTES: None
@dzbarsky
dzbarsky requested a review from a team as a code owner September 18, 2026 12:40
@dzbarsky
dzbarsky requested review from aranguyen and removed request for a team September 18, 2026 12:40
@github-actions github-actions Bot added team-Configurability platforms, toolchains, cquery, select(), config transitions team-Core Skyframe, bazel query, BEP, options parsing, bazelrc awaiting-review PR is awaiting review from an assigned reviewer team-Loading-API BUILD file and macro processing: labels, package(), visibility, glob labels Sep 18, 2026
@fmeum
fmeum requested a review from gregestren September 18, 2026 13:09
Caffeine.newBuilder().weakKeys().build(this::mergeWithImpl);
// Weak keys use identity. Intern equivalent inputs so temporary option copies share entries.
// Values are weak too: a no-op merge returns its input key.
private final LoadingCache<BuildConfigurationKey, BuildConfigurationKey> mergeCache =

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It might be worth splitting this out into a separate PR as it is independent. Also would make easier to benchmark the two changes in isolation.

@meisterT

Copy link
Copy Markdown
Member

I wonder how our build setup is different - I was not able to see any performance gain of analysis of big targets in Google3 during my own benchmarking.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting-review PR is awaiting review from an assigned reviewer team-Configurability platforms, toolchains, cquery, select(), config transitions team-Core Skyframe, bazel query, BEP, options parsing, bazelrc team-Loading-API BUILD file and macro processing: labels, package(), visibility, glob

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants