-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Analysis performance regression when lockfile is enabled #19952
Comments
I'm going to preemptively mark this as a release blocker. 3x slowdown is unacceptable |
@bazel-io fork 7.0.0 |
@purkhusid Could you share the output of |
With
With
With
I did |
@purkhusid Are you able to run Bazel built from source ( |
Ran the proposed fix on on our repo: Note that it's not the same machine as I used for the earlier runs so the overall slowdown compared to that is expected The proposed fix seems to have worked and then some additional perf gain! |
This commit fixes a regression in analysis time caused by 19c0c80. Since `BazelModuleResolutionEvent` and `ModuleExtensionResolutionEvent` are both marked as `storeForReplay`, they are stored in a nested set for essentially all analysis phase nodes. This resulted in frequent (i.e., per target) calls to their `hashCode` methods, which are not cached and delegated to the likewise uncached methods on large `ImmutableMap` and `ImmutableTable` instances. Since there is no need for these events to be deduplicated, switching to reference equality resolves this issue. The following analysis phase measurements for a synthetic project with a single "hub and spokes" module extension and 2,000 repos illustrate the effect: * without lockfile: 4.3s * with lockfile before this commit: 8.3s * with lockfile after this commit: 4.2s Fixes bazelbuild#19952 Closes bazelbuild#19970. PiperOrigin-RevId: 578734010 Change-Id: I870867c5c509389632793b0d5fe5c43ddc6176f3
This commit fixes a regression in analysis time caused by 19c0c80. Since `BazelModuleResolutionEvent` and `ModuleExtensionResolutionEvent` are both marked as `storeForReplay`, they are stored in a nested set for essentially all analysis phase nodes. This resulted in frequent (i.e., per target) calls to their `hashCode` methods, which are not cached and delegated to the likewise uncached methods on large `ImmutableMap` and `ImmutableTable` instances. Since there is no need for these events to be deduplicated, switching to reference equality resolves this issue. The following analysis phase measurements for a synthetic project with a single "hub and spokes" module extension and 2,000 repos illustrate the effect: * without lockfile: 4.3s * with lockfile before this commit: 8.3s * with lockfile after this commit: 4.2s Fixes bazelbuild#19952 Closes bazelbuild#19970. PiperOrigin-RevId: 578734010 Change-Id: I870867c5c509389632793b0d5fe5c43ddc6176f3
This commit fixes a regression in analysis time caused by 19c0c80. Since `BazelModuleResolutionEvent` and `ModuleExtensionResolutionEvent` are both marked as `storeForReplay`, they are stored in a nested set for essentially all analysis phase nodes. This resulted in frequent (i.e., per target) calls to their `hashCode` methods, which are not cached and delegated to the likewise uncached methods on large `ImmutableMap` and `ImmutableTable` instances. Since there is no need for these events to be deduplicated, switching to reference equality resolves this issue. The following analysis phase measurements for a synthetic project with a single "hub and spokes" module extension and 2,000 repos illustrate the effect: * without lockfile: 4.3s * with lockfile before this commit: 8.3s * with lockfile after this commit: 4.2s Fixes #19952 Closes #19970. Commit 435d1c2 PiperOrigin-RevId: 578734010 Change-Id: I870867c5c509389632793b0d5fe5c43ddc6176f3 Co-authored-by: Fabian Meumertzheim <fabian@meumertzhe.im>
A fix for this issue has been included in Bazel 7.0.0 RC5. Please test out the release candidate and report any issues as soon as possible. Thanks! |
Description of the bug:
While migrating our repo to bzlmod we encountered an 3x slowdown in analysis when using bzlmod.
Looking further into it it seems like it's caused by the newly introduced lockfile because the performance returns back to normal when
--lockfile_mode=off
is set.I can unfortunately not share an reproduction since the repo is private. The repo is using MODULE.bazel and WORKSPACE.bzlmod since not all of our external deps have been migrated to bzlmod.
I'll share a profile with and without the lockfile:
timing_profile_with_lockfile.gz
timing_profile_without_lockfile.gz
Tagging @fmeum and @Wyverald since I had talked to them on Slack
Which operating system are you running Bazel on?
Linux Fedora 38
What is the output of
bazel info release
?release 7.0.0rc2
The text was updated successfully, but these errors were encountered: