Skip to content
Snippets Groups Projects
Unverified Commit 2d51e7ad authored by bazel.build machine account's avatar bazel.build machine account Committed by GitHub
Browse files

[7.1.0] Restart at most once when prepopulating repository rule environment (#20643)

When a repository rule is fetch attributes are iterated over in
`enforceLabelAttributes` to prepopulate the environment, restarting the
fetch each time a new dependency is discovered.

This is faster than calling `repository_ctx.path(...)` early in the
repository rule implementation function but still has considerable
overhead.

This PR defers throwing `NeedsSkyframeRestartException` till after every
attribute has been processed, greatly reducing the number of restarts
and iterations.

In an internal project these optimisations are particularly noticeable.
Before: 2min 8s, 2min 7s
After: 1min 35s, 1min 27s

Closes #20434.

Commit
https://github.com/bazelbuild/bazel/commit/e8ac96adb860b9831a62681167295f103a51470a



PiperOrigin-RevId: 588090528
Change-Id: I7917b137d6e60b6d6a73189cf396418a85b3ec28

Co-authored-by: default avatarJordan Mele <mele@canva.com>
Co-authored-by: default avatarXùdōng Yáng <wyverald@gmail.com>
parent ed38b62b
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment