-
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
Intern repository mapping entries #19269
Conversation
All repositories generated by a module extension have the same repository mapping entries. Without interning, if a module extension generates N repositories, each such repository would have its own copy with (more than) N entries, resulting in memory usage that is quadratic in N. We intern the entries, not the RepositoryMapping itself, because the latter also includes the owner repo, which differs between extension repos. Output of `bazel info used-heap-size-after-gc` after running a build with a synthetic module extension generating N + 1 repos: before N=100: 32MB N=1000: 77MB N=3000: 371MB N=5000: 961MB N=10000: 3614MB after N=100: 32MB N=1000: 44MB N=3000: 71MB N=5000: 91MB N=10000: 158MB
@bazel-io flag |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice, thank you for the investigation and prompt fix!
@bazel-io fork 6.4.0 |
@fmeum I accidentally clicked on "Update branch" button, causing a merge commit to be made. Can you please reset to the original commit? My apologies. cc: @bazelbuild/triage |
@iancha1992 I think you are still able to import the PR, you can fix the GIT_AUTHORS manually, I can help review ;) |
All repositories generated by a module extension have the same repository mapping entries. Without interning, if a module extension generates N repositories, each such repository would have its own copy with (more than) N entries, resulting in overall memory usage quadratic in N. We intern the entries, not the `RepositoryMapping` itself, since the latter also includes the owner repo, which differs between extension repos. Output of `bazel info used-heap-size-after-gc` after running a build with a synthetic module extension generating N + 1 repos and requesting all of them: ``` before N=100: 32MB N=1000: 77MB N=3000: 371MB N=5000: 961MB N=10000: 3614MB after N=100: 32MB N=1000: 44MB N=3000: 71MB N=5000: 91MB N=10000: 158MB ``` Closes bazelbuild#19269. PiperOrigin-RevId: 558940840 Change-Id: I07402f203b5f11bf448a1ae9e9ee4637ad4c536d
All repositories generated by a module extension have the same repository mapping entries. Without interning, if a module extension generates N repositories, each such repository would have its own copy with (more than) N entries, resulting in overall memory usage quadratic in N. We intern the entries, not the `RepositoryMapping` itself, since the latter also includes the owner repo, which differs between extension repos. Output of `bazel info used-heap-size-after-gc` after running a build with a synthetic module extension generating N + 1 repos and requesting all of them: ``` before N=100: 32MB N=1000: 77MB N=3000: 371MB N=5000: 961MB N=10000: 3614MB after N=100: 32MB N=1000: 44MB N=3000: 71MB N=5000: 91MB N=10000: 158MB ``` Closes #19269. Commit 74aadb2 PiperOrigin-RevId: 558940840 Change-Id: I07402f203b5f11bf448a1ae9e9ee4637ad4c536d Co-authored-by: Fabian Meumertzheim <fabian@meumertzhe.im>
The changes in this PR have been included in Bazel 6.4.0 RC1. Please test out the release candidate and report any issues as soon as possible. If you're using Bazelisk, you can point to the latest RC by setting USE_BAZEL_VERSION=last_rc. |
All repositories generated by a module extension have the same repository mapping entries. Without interning, if a module extension generates N repositories, each such repository would have its own copy with (more than) N entries, resulting in overall memory usage quadratic in N.
We intern the entries, not the
RepositoryMapping
itself, since the latter also includes the owner repo, which differs between extension repos.Output of
bazel info used-heap-size-after-gc
after running a build with a synthetic module extension generating N + 1 repos and requesting all of them: