Skip to content

Cache rule feature lists#767

Open
dzbarsky wants to merge 1 commit into
bazelbuild:mainfrom
dzbarsky:codex/cache-rule-feature-lists
Open

Cache rule feature lists#767
dzbarsky wants to merge 1 commit into
bazelbuild:mainfrom
dzbarsky:codex/cache-rule-feature-lists

Conversation

@dzbarsky

Copy link
Copy Markdown
Contributor

Summary

ctx.features and ctx.disabled_features allocate a new list on every access. Cache those lists in cc_binary, cc_library, objc_library, and objc_import, then pass the cached lists through the existing feature-configuration helpers.

This reduces ctx.features accesses from up to five to one for cc_binary/cc_test, from up to four to one for cc_library, and reduces both property accesses from four to one for objc_library and from two to one for objc_import. Optional helper arguments preserve behavior for existing external callers.

Validation

  • buildifier -mode=check on all changed Starlark files
  • bazel test --jobs=4 --test_output=errors //tests/cc/common:cc_common_tests //tests/cc/common:cc_binary_configured_target_tests //tests/cc/common:cc_objc_library_configured_target_tests

@dzbarsky dzbarsky marked this pull request as ready for review June 21, 2026 14:11
@dzbarsky dzbarsky changed the title [codex] Cache rule feature lists Cache rule feature lists Jun 21, 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