Skip to content

Rollup of 3 perf-sensitive pull requests - #162183

Merged
rust-bors[bot] merged 8 commits into
rust-lang:mainfrom
JonathanBrouwer:rollup-IgUDpJR
Sep 2, 2026
Merged

Rollup of 3 perf-sensitive pull requests#162183
rust-bors[bot] merged 8 commits into
rust-lang:mainfrom
JonathanBrouwer:rollup-IgUDpJR

Conversation

@JonathanBrouwer

Copy link
Copy Markdown
Member

Successful merges:

r? @ghost

Create a similar rollup

laundmo and others added 8 commits August 30, 2026 15:46
Empty token streams are common. Every one causes an allocation for the
`Arc::new()`. We can instead have a single shared empty `TokenStream`
and `AttrTokenStream`.
…jackh726

Store LiveLoans more densely packed

`LiveLoans` originally used `SparseBitMatrix<PointIndex, BorrowIndex>` in a way that didn't use "the sparseness" very effectively. The borrow dimension is usually very low (<10 bits 90% of the time), while the point dimension is typically order of magnitude higher.

This means that we used to allocate a bunch of 32-byte `DenseBitSet`s that only point to a few bits in heap-allocated `u64`. We only saved some memory by not allocating the whole `PointIndex` range, but we still often need to allocatate most of it.

This PR changes the representation to use a single flat representation with `GrowableBitSet` storing all bits in a single Vec. There's still a room for improvement but this should be a positive step forward.

r? lqd
…lcnr

Reduce next-solver memory usage by interning CanonicalQueryInput

Goal: Reduce memory usage of next-solver especially when exceeding recursion limit

Changes:
- Added Interner::CanonicalInput associated type and surrounding interning machinery (mostly copied from ExternalConstraints)
- Changed Cx::Input to be I:CanonicalInput and adjusted other places in the code to match, including calling the interning during canonicalize_goal

Results:
According to Heaptrack (and btop) peak memory usage for compiling `bevy_render` (like rust-lang#161748) with next-solver enabled was reduced from ~15GiB to ~4GiB since most of it was the HashMap index for NestedGoals (and search_graph::GlobalCache), which used to be 56 bytes (IIRC), but now is a single reference thanks to Interned.

Closes (maybe): rust-lang#161748
Tracking issue: rust-lang/goals#113 and rust-lang#160895 (comment)

r? @lcnr
…Kobzol

Optimize empty token streams

Empty token streams are common. Every one causes an allocation for the `Arc::new()`. We can instead have a single shared empty `TokenStream` and `AttrTokenStream`.

r? @Kobzol
@rust-bors rust-bors Bot added the rollup A PR which is a rollup label Sep 2, 2026
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver) labels Sep 2, 2026
@JonathanBrouwer

Copy link
Copy Markdown
Member Author

@bors r+ p=5

Trying commonly failed jobs
@bors try jobs=dist-various-1,test-various,x86_64-gnu-aux,x86_64-gnu-llvm-21-3,x86_64-msvc-1,aarch64-apple-1,aarch64-apple-2,x86_64-mingw-1,i686-msvc-1,i686-msvc-2

@rust-bors

rust-bors Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

📌 Commit d5b8ff4 has been approved by JonathanBrouwer

It is now in the queue for this repository.

@rust-bors rust-bors Bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 2, 2026
@JonathanBrouwer JonathanBrouwer changed the title Rollup of 3 pull requests Rollup of 3 perf-sensitive pull requests Sep 2, 2026
@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Sep 2, 2026
Rollup of 3 pull requests


try-job: dist-various-1
try-job: test-various
try-job: x86_64-gnu-aux
try-job: x86_64-gnu-llvm-21-3
try-job: x86_64-msvc-1
try-job: aarch64-apple-1
try-job: aarch64-apple-2
try-job: x86_64-mingw-1
try-job: i686-msvc-1
try-job: i686-msvc-2
@rust-bors

rust-bors Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: 24bb055 (24bb0551fd052ad99a8eebb500e8edc05d453613)
Base parent: 3a43cb6 (3a43cb66f97d08ccde87a00599fac2d3c50eb177)

@rust-bors

This comment has been minimized.

@rust-bors rust-bors Bot added merged-by-bors This PR was explicitly merged by bors. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Sep 2, 2026
@rust-bors

rust-bors Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

☀️ Test successful - CI
Approved by: JonathanBrouwer
Duration: 3h 7m 5s
Pushing 824336a to main...

@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor
What is this? This is an experimental post-merge analysis report that shows differences in test outcomes between the merged PR and its parent PR.

Comparing 59dabe5 (parent) -> 824336a (this PR)

Test differences

No test diffs found

Test dashboard

Run

cargo run --manifest-path src/ci/citool/Cargo.toml -- \
    test-dashboard 824336ad4127ce295849937a24c08a4aeff6ada7 --output-dir test-dashboard

And then open test-dashboard/index.html in your browser to see an overview of all executed tests.

Job duration changes

  1. x86_64-gnu-stdlib-semver-check: 11m 19s -> 17m 54s (+58.2%)
  2. x86_64-gnu-llvm-21-2: 1h 9m -> 1h 43m (+49.3%)
  3. x86_64-gnu: 1h 43m -> 2h 31m (+46.7%)
  4. dist-ohos-armv7: 54m 55s -> 1h 18m (+43.5%)
  5. x86_64-gnu-tools: 49m 43s -> 1h 9m (+40.2%)
  6. x86_64-gnu-gcc: 57m 28s -> 1h 19m (+38.1%)
  7. dist-arm-linux-musl: 1h 19m -> 1h 47m (+35.9%)
  8. x86_64-gnu-distcheck: 1h 43m -> 2h 18m (+34.3%)
  9. dist-s390x-linux: 1h 31m -> 1h 4m (-29.9%)
  10. dist-x86_64-netbsd: 1h 29m -> 1h 3m (-29.0%)
How to interpret the job duration changes?

Job durations can vary a lot, based on the actual runner instance
that executed the job, system noise, invalidated caches, etc. The table above is provided
mostly for t-infra members, for simpler debugging of potential CI slow-downs.

@rust-bors

rust-bors Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

📌 Perf builds for each rolled up PR:

PR# Message Perf Build Sha
#161850 Store LiveLoans more densely packed a9c8aa3e069626765fa9492fcd7d2030ee024a6a
(link)
#162031 Reduce next-solver memory usage by interning CanonicalQuery… cd59165899980b4f1ed4ef005ad26b81afb52271
(link)
#162047 Optimize empty token streams 2d373c084c0ad231045112828dff4e7deb769cfe
(link)

parent commit: 59dabe56f7

In the case of a perf regression, run the following command for each PR you suspect might be the cause: @rust-timer build $SHA

@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (824336a): comparison URL.

Overall result: ❌✅ regressions and improvements - please read:

Our benchmarks found a performance regression caused by this PR.
This might be an actual regression, but it can also be just noise.

Next Steps:

  • If the regression was expected or you think it can be justified,
    please write a comment with sufficient written justification, and add
    @rustbot label: +perf-regression-triaged to it, to mark the regression as triaged.
  • If you think that you know of a way to resolve the regression, try to create
    a new PR with a fix for the regression.
  • If you do not understand the regression or you think that it is just noise,
    you can ask the @rust-lang/wg-compiler-performance working group for help (members of this group
    were already notified of this PR).

@rustbot label: +perf-regression
cc @rust-lang/wg-compiler-performance

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
0.1% [0.1%, 0.2%] 9
Improvements ✅
(primary)
-0.3% [-1.3%, -0.1%] 49
Improvements ✅
(secondary)
-0.3% [-0.7%, -0.1%] 39
All ❌✅ (primary) -0.3% [-1.3%, -0.1%] 49

Max RSS (memory usage)

Results (primary -1.9%, secondary -0.4%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
4.4% [1.8%, 11.2%] 8
Improvements ✅
(primary)
-1.9% [-4.1%, -0.5%] 8
Improvements ✅
(secondary)
-2.5% [-6.3%, -0.7%] 18
All ❌✅ (primary) -1.9% [-4.1%, -0.5%] 8

Cycles

Results (primary -2.5%, secondary -0.3%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
8.5% [4.3%, 12.2%] 4
Improvements ✅
(primary)
-2.5% [-2.7%, -2.0%] 3
Improvements ✅
(secondary)
-5.4% [-8.5%, -2.7%] 7
All ❌✅ (primary) -2.5% [-2.7%, -2.0%] 3

Binary size

This perf run didn't have relevant results for this metric.

Bootstrap: 473.905s -> 473.106s (-0.17%)
Artifact size: 400.83 MiB -> 401.09 MiB (0.06%)

@rustbot rustbot added the perf-regression Performance regression. label Sep 2, 2026
@JonathanBrouwer

Copy link
Copy Markdown
Member Author

@rust-timer triage a9c8aa3 cd59165 2d373c0

@rust-timer

rust-timer commented Sep 2, 2026

Copy link
Copy Markdown
Collaborator
Running triage with 26 benchmarks

Triage only executes the benchmarks on rollup members, that were changed significantly on the rollup.
For this rollup, these benchmarks are:

  • cargo-0.87.1
  • clap_derive-4.5.32
  • clap_derive-4.5.32-nll
  • cranelift-codegen-0.119.0
  • derive
  • externs
  • html5ever-0.31.0
  • hyper-1.6.0
  • image-0.25.6
  • include-blob
  • libc-0.2.172
  • many-assoc-items
  • match-stress
  • nalgebra-0.33.0
  • nalgebra-0.33.0-new-solver
  • regex-automata-0.4.8
  • ripgrep-14.1.1
  • ripgrep-14.1.1-nll
  • serde-1.0.219
  • serde-1.0.219-nll
  • serde_derive-1.0.219
  • stm32f4-0.15.1
  • syn-2.0.101
  • tt-muncher
  • typenum-1.18.0-new-solver
  • unused-warnings

#161850 a9c8aa3 Store LiveLoans more densely packed

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.4% [-1.2%, -0.1%] 22
Improvements ✅
(secondary)
-0.2% [-0.4%, -0.0%] 7
All ❌✅ (primary) -0.4% [-1.2%, -0.1%] 22

Max RSS (memory usage)

Results (primary -1.7%, secondary 0.5%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
2.6% [2.6%, 2.6%] 1
Regressions ❌
(secondary)
4.0% [3.3%, 4.7%] 3
Improvements ✅
(primary)
-3.1% [-4.1%, -2.5%] 3
Improvements ✅
(secondary)
-3.0% [-3.1%, -2.8%] 3
All ❌✅ (primary) -1.7% [-4.1%, 2.6%] 4

Cycles

Results (primary 2.3%, secondary 5.0%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
2.3% [2.3%, 2.3%] 1
Regressions ❌
(secondary)
5.0% [2.9%, 7.6%] 7
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 2.3% [2.3%, 2.3%] 1

Binary size

This perf run didn't have relevant results for this metric.


#162031 cd59165 Reduce next-solver memory usage by interning CanonicalQueryInput

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
0.2% [0.1%, 0.3%] 5
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-0.3% [-0.5%, -0.0%] 6
All ❌✅ (primary) - - 0

Max RSS (memory usage)

Results (secondary -1.6%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-1.6% [-2.3%, -0.8%] 6
All ❌✅ (primary) - - 0

Cycles

Results (secondary -1.2%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
10.4% [9.1%, 12.7%] 3
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-5.5% [-8.8%, -2.2%] 8
All ❌✅ (primary) - - 0

Binary size

This perf run didn't have relevant results for this metric.


#162047 2d373c0 Optimize empty token streams

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
0.2% [0.1%, 0.4%] 14
Improvements ✅
(primary)
-0.2% [-0.4%, -0.1%] 18
Improvements ✅
(secondary)
-0.3% [-0.7%, -0.1%] 29
All ❌✅ (primary) -0.2% [-0.4%, -0.1%] 18

Max RSS (memory usage)

Results (primary 1.1%, secondary -3.9%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
2.7% [2.7%, 2.7%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.4% [-0.4%, -0.4%] 1
Improvements ✅
(secondary)
-3.9% [-6.2%, -1.2%] 5
All ❌✅ (primary) 1.1% [-0.4%, 2.7%] 2

Cycles

Results (primary -3.6%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-3.6% [-3.6%, -3.6%] 1
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -3.6% [-3.6%, -3.6%] 1

Binary size

This perf run didn't have relevant results for this metric.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merged-by-bors This PR was explicitly merged by bors. perf-regression Performance regression. rollup A PR which is a rollup T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants