[L] Change in bazel/bazel[master]: Improve performance of `BuiltinRestriction` checks.

0 views
Skip to first unread message

Copybara Service (Gerrit)

unread,
May 29, 2026, 8:14:50 AM (5 days ago) May 29
to bazel-...@googlegroups.com

Copybara Service submitted the change

Change information

Commit message:
Improve performance of `BuiltinRestriction` checks.

`BuiltinRestriction` checks an allowlist on every private starlark API call, making it a hot code path. Improvements:

* Check all main repo allowlist entries first to avoid applying `RepositoryMapping` if possible.
* Move more common allowlist entries earlier in the allowlist to short-circuit.
* Replace streams with standard loops.
* Cache the conversion from starlark to java representation.
PiperOrigin-RevId: 923346855
Change-Id: I76e0e170a923587485dd0941539f8a9dd78515c2
Files:
  • M src/main/java/com/google/devtools/build/lib/analysis/starlark/StarlarkRuleClassFunctions.java
  • M src/main/java/com/google/devtools/build/lib/packages/BuiltinRestriction.java
  • M src/main/java/com/google/devtools/build/lib/rules/cpp/CcStarlarkInternal.java
  • M src/main/java/com/google/devtools/build/lib/rules/proto/BazelProtoCommon.java
  • M src/main/starlark/builtins_bzl/common/java/java_common.bzl
Change size: L
Delta: 5 files changed, 240 insertions(+), 118 deletions(-)
Branch: refs/heads/master
Open in Gerrit
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: merged
Gerrit-Project: bazel
Gerrit-Branch: master
Gerrit-Change-Id: I76e0e170a923587485dd0941539f8a9dd78515c2
Gerrit-Change-Number: 328430
Gerrit-PatchSet: 5
Gerrit-Owner: Copybara Service <copybara-wor...@google.com>
open
diffy

Copybara Service (Gerrit)

unread,
May 29, 2026, 8:14:50 AM (5 days ago) May 29
to bazel-...@googlegroups.com

Copybara Service uploaded new patchset

Copybara Service uploaded patch set #5 to this change.
Open in Gerrit

Related details

Attention set is empty
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: newpatchset
open
diffy
Reply all
Reply to author
Forward
0 new messages