Skip to content

Shrink PartialRes and its alignment - #163916

Merged
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
joshtriplett:partialres-shrink
Oct 8, 2026
Merged

rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
joshtriplett:partialres-shrink

Conversation

@joshtriplett

Copy link
Copy Markdown
Member

A couple of places store NodeMap<PartialRes>, which is FxHashMap<NodeId, PartialRes>, which stores (NodeId, PartialRes).

(NodeId, PartialRes) takes up 32 bytes. PartialRes contains a usize count of unresolved segments, in that path. We don't need room for more than 2^32 unresolved segments, so store it as a u32. That shrinks PartialRes and reduces its alignment, so (NodeId, PartialRes) shrinks to 20 bytes.

We store a lot of those.

For aws-sdk-ec2 (full check), this reduces max-rss by ~102 MiB (1.84%)

A couple of places store `NodeMap<PartialRes>`, which is
`FxHashMap<NodeId, PartialRes>`, which stores `(NodeId, PartialRes)`.

`(NodeId, PartialRes)` takes up 32 bytes. `PartialRes` contains a
`usize` count of unresolved segments, in *that* path. We don't need room
for more than 2^32 unresolved segments, so store it as a u32. That
shrinks `PartialRes` and reduces its alignment, so `(NodeId,
PartialRes)` shrinks to 20 bytes.

We store a *lot* of those.

For aws-sdk-ec2 (full check), this reduces max-rss by ~102 MiB (1.84%)
@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. labels Oct 7, 2026
@rustbot

rustbot commented Oct 7, 2026

Copy link
Copy Markdown
Collaborator

r? @oli-obk

rustbot has assigned @oli-obk.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: compiler
  • compiler expanded to 77 candidates
  • Random selection from 19 candidates

@joshtriplett

Copy link
Copy Markdown
Member Author

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Oct 7, 2026
@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Oct 7, 2026
Shrink `PartialRes` and its alignment
@rust-bors

rust-bors Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: 7035dc6 (7035dc6ae3d9b54364207d000754dc089c409cb7)
Base parent: 8d1a764 (8d1a76430406c877b35d0b627e7f796dcf0dfeca)

@rust-timer

This comment has been minimized.

@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (7035dc6): comparison URL.

Overall result: ✅ improvements - no action needed

Benchmarking means the PR may be perf-sensitive. Consider adding rollup=never if this change is not fit for rolling up.

@rustbot label: -S-waiting-on-perf -perf-regression

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.8% [-0.9%, -0.7%] 2
Improvements ✅
(secondary)
-0.1% [-0.1%, -0.1%] 1
All ❌✅ (primary) -0.8% [-0.9%, -0.7%] 2

Max RSS (memory usage)

Results (primary -0.8%, secondary 0.1%)

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

mean range count
Regressions ❌
(primary)
1.9% [0.6%, 2.7%] 10
Regressions ❌
(secondary)
1.9% [1.0%, 3.0%] 9
Improvements ✅
(primary)
-1.6% [-3.2%, -0.5%] 31
Improvements ✅
(secondary)
-1.9% [-5.9%, -0.6%] 8
All ❌✅ (primary) -0.8% [-3.2%, 2.7%] 41

Cycles

Results (primary -2.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)
- - 0
Improvements ✅
(primary)
-2.3% [-2.3%, -2.3%] 1
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.

Bootstrap: 489.893s -> 489.532s (-0.07%)
Artifact size: 408.60 MiB -> 408.63 MiB (0.01%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Oct 7, 2026
@lqd

lqd commented Oct 7, 2026

Copy link
Copy Markdown
Member

Nice!

r? me @bors r+

@rust-bors

rust-bors Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

📌 Commit aaa57c9 has been approved by lqd

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 Oct 7, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Oct 7, 2026
Shrink `PartialRes` and its alignment

A couple of places store `NodeMap<PartialRes>`, which is `FxHashMap<NodeId, PartialRes>`, which stores `(NodeId, PartialRes)`.

`(NodeId, PartialRes)` takes up 32 bytes. `PartialRes` contains a `usize` count of unresolved segments, in *that* path. We don't need room for more than 2^32 unresolved segments, so store it as a u32. That shrinks `PartialRes` and reduces its alignment, so `(NodeId, PartialRes)` shrinks to 20 bytes.

We store a *lot* of those.

For aws-sdk-ec2 (full check), this reduces max-rss by ~102 MiB (1.84%)
rust-bors Bot pushed a commit that referenced this pull request Oct 7, 2026
…uwer

Rollup of 25 pull requests

Successful merges:

 - #163090 (Run LLDB debuginfo tests on `x86_64-pc-windows-msvc` in CI)
 - #163806 (even more `tests/crashes` migration for `-Znext-solver`)
 - #162156 (add IBM f128 type)
 - #163508 (Document the `rustc_on_unimplemented` attribute.)
 - #163794 (Use `target_family = "wasm"` instead of `target_arch = "wasm32"`)
 - #163863 (use the type name instead of `Self` in constructor paths again)
 - #163864 (Remove CLAUDE.md)
 - #163877 (Add regression test for duplicated rustdoc search results between std and core)
 - #163916 (Shrink `PartialRes` and its alignment)
 - #149753 (On name resolution error in parameter list, suggest possible `const` typo and avoid unnecessary second error)
 - #152557 (Oneshot `is_ready`)
 - #157273 (Stabilize `optimize` attribute)
 - #162000 (peel_transparent_wrappers only works on non-1ZST)
 - #163257 (abby DSL: sanity checks on forall where clauses)
 - #163343 (`unit` and `[1 x unit]` layouts are incompatible on big-endian targets)
 - #163348 (perf:cache FFI safety results in improper_ctypes lint)
 - #163768 (Move more `rustdoc-html` tests in the right location)
 - #163778 (check is_indirect_first_projection when replacing in RefProp)
 - #163789 (cg_llvm: Avoid `as_c_char_ptr` in several places)
 - #163807 (Add `has_reliable_f16b` for Arm)
 - #163809 (Switch TLS implementation for wasi and bump SDK version to 34)
 - #163826 (Update books)
 - #163849 (ci: update to PowerShell 7.6.6)
 - #163869 (INSTALL.md: use UCRT64 instead of MINGW64 in MSYS2 section)
 - #163870 (Add if-installed:auto:spellcheck to pre-push script)
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Oct 7, 2026
Shrink `PartialRes` and its alignment

A couple of places store `NodeMap<PartialRes>`, which is `FxHashMap<NodeId, PartialRes>`, which stores `(NodeId, PartialRes)`.

`(NodeId, PartialRes)` takes up 32 bytes. `PartialRes` contains a `usize` count of unresolved segments, in *that* path. We don't need room for more than 2^32 unresolved segments, so store it as a u32. That shrinks `PartialRes` and reduces its alignment, so `(NodeId, PartialRes)` shrinks to 20 bytes.

We store a *lot* of those.

For aws-sdk-ec2 (full check), this reduces max-rss by ~102 MiB (1.84%)
rust-bors Bot pushed a commit that referenced this pull request Oct 7, 2026
…uwer

Rollup of 24 pull requests

Successful merges:

 - #163090 (Run LLDB debuginfo tests on `x86_64-pc-windows-msvc` in CI)
 - #163806 (even more `tests/crashes` migration for `-Znext-solver`)
 - #163508 (Document the `rustc_on_unimplemented` attribute.)
 - #163794 (Use `target_family = "wasm"` instead of `target_arch = "wasm32"`)
 - #163863 (use the type name instead of `Self` in constructor paths again)
 - #163864 (Remove CLAUDE.md)
 - #163877 (Add regression test for duplicated rustdoc search results between std and core)
 - #163916 (Shrink `PartialRes` and its alignment)
 - #149753 (On name resolution error in parameter list, suggest possible `const` typo and avoid unnecessary second error)
 - #152557 (Oneshot `is_ready`)
 - #157273 (Stabilize `optimize` attribute)
 - #162000 (peel_transparent_wrappers only works on non-1ZST)
 - #163257 (abby DSL: sanity checks on forall where clauses)
 - #163343 (`unit` and `[1 x unit]` layouts are incompatible on big-endian targets)
 - #163348 (perf:cache FFI safety results in improper_ctypes lint)
 - #163768 (Move more `rustdoc-html` tests in the right location)
 - #163778 (check is_indirect_first_projection when replacing in RefProp)
 - #163789 (cg_llvm: Avoid `as_c_char_ptr` in several places)
 - #163807 (Add `has_reliable_f16b` for Arm)
 - #163809 (Switch TLS implementation for wasi and bump SDK version to 34)
 - #163826 (Update books)
 - #163849 (ci: update to PowerShell 7.6.6)
 - #163869 (INSTALL.md: use UCRT64 instead of MINGW64 in MSYS2 section)
 - #163870 (Add if-installed:auto:spellcheck to pre-push script)
rust-bors Bot pushed a commit that referenced this pull request Oct 7, 2026
…uwer

Rollup of 24 pull requests

Successful merges:

 - #163090 (Run LLDB debuginfo tests on `x86_64-pc-windows-msvc` in CI)
 - #163806 (even more `tests/crashes` migration for `-Znext-solver`)
 - #163508 (Document the `rustc_on_unimplemented` attribute.)
 - #163794 (Use `target_family = "wasm"` instead of `target_arch = "wasm32"`)
 - #163863 (use the type name instead of `Self` in constructor paths again)
 - #163864 (Remove CLAUDE.md)
 - #163877 (Add regression test for duplicated rustdoc search results between std and core)
 - #163916 (Shrink `PartialRes` and its alignment)
 - #149753 (On name resolution error in parameter list, suggest possible `const` typo and avoid unnecessary second error)
 - #152557 (Oneshot `is_ready`)
 - #157273 (Stabilize `optimize` attribute)
 - #162000 (peel_transparent_wrappers only works on non-1ZST)
 - #163257 (abby DSL: sanity checks on forall where clauses)
 - #163343 (`unit` and `[1 x unit]` layouts are incompatible on big-endian targets)
 - #163348 (perf:cache FFI safety results in improper_ctypes lint)
 - #163768 (Move more `rustdoc-html` tests in the right location)
 - #163778 (check is_indirect_first_projection when replacing in RefProp)
 - #163789 (cg_llvm: Avoid `as_c_char_ptr` in several places)
 - #163807 (Add `has_reliable_f16b` for Arm)
 - #163809 (Switch TLS implementation for wasi and bump SDK version to 34)
 - #163826 (Update books)
 - #163849 (ci: update to PowerShell 7.6.6)
 - #163869 (INSTALL.md: use UCRT64 instead of MINGW64 in MSYS2 section)
 - #163870 (Add if-installed:auto:spellcheck to pre-push script)
rust-bors Bot pushed a commit that referenced this pull request Oct 7, 2026
…uwer

Rollup of 24 pull requests

Successful merges:

 - #163090 (Run LLDB debuginfo tests on `x86_64-pc-windows-msvc` in CI)
 - #163806 (even more `tests/crashes` migration for `-Znext-solver`)
 - #163508 (Document the `rustc_on_unimplemented` attribute.)
 - #163794 (Use `target_family = "wasm"` instead of `target_arch = "wasm32"`)
 - #163863 (use the type name instead of `Self` in constructor paths again)
 - #163864 (Remove CLAUDE.md)
 - #163877 (Add regression test for duplicated rustdoc search results between std and core)
 - #163916 (Shrink `PartialRes` and its alignment)
 - #149753 (On name resolution error in parameter list, suggest possible `const` typo and avoid unnecessary second error)
 - #152557 (Oneshot `is_ready`)
 - #157273 (Stabilize `optimize` attribute)
 - #162000 (peel_transparent_wrappers only works on non-1ZST)
 - #163257 (abby DSL: sanity checks on forall where clauses)
 - #163343 (`unit` and `[1 x unit]` layouts are incompatible on big-endian targets)
 - #163348 (perf:cache FFI safety results in improper_ctypes lint)
 - #163768 (Move more `rustdoc-html` tests in the right location)
 - #163778 (check is_indirect_first_projection when replacing in RefProp)
 - #163789 (cg_llvm: Avoid `as_c_char_ptr` in several places)
 - #163807 (Add `has_reliable_f16b` for Arm)
 - #163809 (Switch TLS implementation for wasi and bump SDK version to 34)
 - #163826 (Update books)
 - #163849 (ci: update to PowerShell 7.6.6)
 - #163869 (INSTALL.md: use UCRT64 instead of MINGW64 in MSYS2 section)
 - #163870 (Add if-installed:auto:spellcheck to pre-push script)
rust-bors Bot pushed a commit that referenced this pull request Oct 7, 2026
…uwer

Rollup of 24 pull requests

Successful merges:

 - #163090 (Run LLDB debuginfo tests on `x86_64-pc-windows-msvc` in CI)
 - #163806 (even more `tests/crashes` migration for `-Znext-solver`)
 - #163508 (Document the `rustc_on_unimplemented` attribute.)
 - #163794 (Use `target_family = "wasm"` instead of `target_arch = "wasm32"`)
 - #163863 (use the type name instead of `Self` in constructor paths again)
 - #163864 (Remove CLAUDE.md)
 - #163877 (Add regression test for duplicated rustdoc search results between std and core)
 - #163916 (Shrink `PartialRes` and its alignment)
 - #149753 (On name resolution error in parameter list, suggest possible `const` typo and avoid unnecessary second error)
 - #152557 (Oneshot `is_ready`)
 - #157273 (Stabilize `optimize` attribute)
 - #162000 (peel_transparent_wrappers only works on non-1ZST)
 - #163257 (abby DSL: sanity checks on forall where clauses)
 - #163343 (`unit` and `[1 x unit]` layouts are incompatible on big-endian targets)
 - #163348 (perf:cache FFI safety results in improper_ctypes lint)
 - #163768 (Move more `rustdoc-html` tests in the right location)
 - #163778 (check is_indirect_first_projection when replacing in RefProp)
 - #163789 (cg_llvm: Avoid `as_c_char_ptr` in several places)
 - #163807 (Add `has_reliable_f16b` for Arm)
 - #163809 (Switch TLS implementation for wasi and bump SDK version to 34)
 - #163826 (Update books)
 - #163849 (ci: update to PowerShell 7.6.6)
 - #163869 (INSTALL.md: use UCRT64 instead of MINGW64 in MSYS2 section)
 - #163870 (Add if-installed:auto:spellcheck to pre-push script)
rust-bors Bot pushed a commit that referenced this pull request Oct 7, 2026
…uwer

Rollup of 23 pull requests

Successful merges:

 - #163090 (Run LLDB debuginfo tests on `x86_64-pc-windows-msvc` in CI)
 - #163806 (even more `tests/crashes` migration for `-Znext-solver`)
 - #163508 (Document the `rustc_on_unimplemented` attribute.)
 - #163794 (Use `target_family = "wasm"` instead of `target_arch = "wasm32"`)
 - #163863 (use the type name instead of `Self` in constructor paths again)
 - #163864 (Remove CLAUDE.md)
 - #163877 (Add regression test for duplicated rustdoc search results between std and core)
 - #163916 (Shrink `PartialRes` and its alignment)
 - #149753 (On name resolution error in parameter list, suggest possible `const` typo and avoid unnecessary second error)
 - #152557 (Oneshot `is_ready`)
 - #157273 (Stabilize `optimize` attribute)
 - #162000 (peel_transparent_wrappers only works on non-1ZST)
 - #163343 (`unit` and `[1 x unit]` layouts are incompatible on big-endian targets)
 - #163348 (perf:cache FFI safety results in improper_ctypes lint)
 - #163768 (Move more `rustdoc-html` tests in the right location)
 - #163778 (check is_indirect_first_projection when replacing in RefProp)
 - #163789 (cg_llvm: Avoid `as_c_char_ptr` in several places)
 - #163807 (Add `has_reliable_f16b` for Arm)
 - #163809 (Switch TLS implementation for wasi and bump SDK version to 34)
 - #163826 (Update books)
 - #163849 (ci: update to PowerShell 7.6.6)
 - #163869 (INSTALL.md: use UCRT64 instead of MINGW64 in MSYS2 section)
 - #163870 (Add if-installed:auto:spellcheck to pre-push script)
@rust-bors
rust-bors Bot merged commit 76f5c92 into rust-lang:main Oct 8, 2026
15 checks passed
@rustbot rustbot added this to the 1.101.0 milestone Oct 8, 2026
rust-bors Bot pushed a commit that referenced this pull request Oct 8, 2026
Rollup merge of #163916 - joshtriplett:partialres-shrink, r=lqd

Shrink `PartialRes` and its alignment

A couple of places store `NodeMap<PartialRes>`, which is `FxHashMap<NodeId, PartialRes>`, which stores `(NodeId, PartialRes)`.

`(NodeId, PartialRes)` takes up 32 bytes. `PartialRes` contains a `usize` count of unresolved segments, in *that* path. We don't need room for more than 2^32 unresolved segments, so store it as a u32. That shrinks `PartialRes` and reduces its alignment, so `(NodeId, PartialRes)` shrinks to 20 bytes.

We store a *lot* of those.

For aws-sdk-ec2 (full check), this reduces max-rss by ~102 MiB (1.84%)
@joshtriplett
joshtriplett deleted the partialres-shrink branch October 8, 2026 06:46
github-actions Bot pushed a commit to rust-lang/rustc-dev-guide that referenced this pull request Oct 10, 2026
…uwer

Rollup of 23 pull requests

Successful merges:

 - rust-lang/rust#163090 (Run LLDB debuginfo tests on `x86_64-pc-windows-msvc` in CI)
 - rust-lang/rust#163806 (even more `tests/crashes` migration for `-Znext-solver`)
 - rust-lang/rust#163508 (Document the `rustc_on_unimplemented` attribute.)
 - rust-lang/rust#163794 (Use `target_family = "wasm"` instead of `target_arch = "wasm32"`)
 - rust-lang/rust#163863 (use the type name instead of `Self` in constructor paths again)
 - rust-lang/rust#163864 (Remove CLAUDE.md)
 - rust-lang/rust#163877 (Add regression test for duplicated rustdoc search results between std and core)
 - rust-lang/rust#163916 (Shrink `PartialRes` and its alignment)
 - rust-lang/rust#149753 (On name resolution error in parameter list, suggest possible `const` typo and avoid unnecessary second error)
 - rust-lang/rust#152557 (Oneshot `is_ready`)
 - rust-lang/rust#157273 (Stabilize `optimize` attribute)
 - rust-lang/rust#162000 (peel_transparent_wrappers only works on non-1ZST)
 - rust-lang/rust#163343 (`unit` and `[1 x unit]` layouts are incompatible on big-endian targets)
 - rust-lang/rust#163348 (perf:cache FFI safety results in improper_ctypes lint)
 - rust-lang/rust#163768 (Move more `rustdoc-html` tests in the right location)
 - rust-lang/rust#163778 (check is_indirect_first_projection when replacing in RefProp)
 - rust-lang/rust#163789 (cg_llvm: Avoid `as_c_char_ptr` in several places)
 - rust-lang/rust#163807 (Add `has_reliable_f16b` for Arm)
 - rust-lang/rust#163809 (Switch TLS implementation for wasi and bump SDK version to 34)
 - rust-lang/rust#163826 (Update books)
 - rust-lang/rust#163849 (ci: update to PowerShell 7.6.6)
 - rust-lang/rust#163869 (INSTALL.md: use UCRT64 instead of MINGW64 in MSYS2 section)
 - rust-lang/rust#163870 (Add if-installed:auto:spellcheck to pre-push script)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants