Skip to content

perf: Store 1 bit for splatting in FnDeclFlags#157954

Open
teor2345 wants to merge 2 commits into
rust-lang:mainfrom
teor2345:fn-arg-splat-perf-fndef-bitpack
Open

perf: Store 1 bit for splatting in FnDeclFlags#157954
teor2345 wants to merge 2 commits into
rust-lang:mainfrom
teor2345:fn-arg-splat-perf-fndef-bitpack

Conversation

@teor2345

@teor2345 teor2345 commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

This PR tries to fix a perf regression in 1 primary benchmark introduced by #157699, by reducing the extra data in FnDecl to 1 bit (packed into existing free bits).

Regression details: #157699 (comment)

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jun 16, 2026
@panstromek

Copy link
Copy Markdown
Contributor

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rust-bors

This comment has been minimized.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jun 16, 2026
rust-bors Bot pushed a commit that referenced this pull request Jun 16, 2026
…try>

perf: Store 1 bit for splatting in FnDeclFlags
@rust-bors

rust-bors Bot commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: a9e2a2a (a9e2a2a9a4f966e632b0252ea4a224cf87f73c7c, parent: 9d862dd2c17b2dc90e9f623bb9279a8c4090b311)

@rust-timer

This comment has been minimized.

@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (a9e2a2a): comparison URL.

Overall result: no relevant changes - 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

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

Max RSS (memory usage)

Results (secondary -2.0%)

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)
-2.0% [-2.0%, -2.0%] 1
All ❌✅ (primary) - - 0

Cycles

Results (primary -2.7%, 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)
- - 0
Regressions ❌
(secondary)
2.5% [2.5%, 2.5%] 1
Improvements ✅
(primary)
-2.7% [-2.7%, -2.7%] 1
Improvements ✅
(secondary)
-2.3% [-2.3%, -2.3%] 1
All ❌✅ (primary) -2.7% [-2.7%, -2.7%] 1

Binary size

Results (primary -0.1%, 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)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.1% [-0.1%, -0.0%] 53
Improvements ✅
(secondary)
-0.1% [-0.1%, -0.0%] 23
All ❌✅ (primary) -0.1% [-0.1%, -0.0%] 53

Bootstrap: 519.36s -> 519.482s (0.02%)
Artifact size: 400.90 MiB -> 401.36 MiB (0.11%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jun 16, 2026
@teor2345

teor2345 commented Jun 16, 2026

Copy link
Copy Markdown
Contributor Author

Well that's good I guess, the complicated fix has no perf impact, so we don't need to do it.

@panstromek

Copy link
Copy Markdown
Contributor

The result can also be interpreted as slightly positive. If you tick show non relevant results, most of them are green. That can be misleading, because each one got marked as insignificant on its own, but if they are collectively largely green, then that's usually a good sign.

unicode-normalization incr-unchanged (the one you're trying to address) also shows improvements in metadata related queries in detailed results. That table uses cpu-clock which is a bit noisy, so it's also not such a strong signal (and there are bigger changes on other queries or variants of this benchmark).

We have to take all of this with a massive grain of salt but I'd be cautiously optimistic about the result :D.

@teor2345

Copy link
Copy Markdown
Contributor Author

I would expect most results to be positive because we're reducing the data size of FnDef, so there's less data being copied around.

Let's merge this as a partial mitigation of the regression in #157699 (comment)

@teor2345 teor2345 marked this pull request as ready for review June 16, 2026 12:28
@rustbot

rustbot commented Jun 16, 2026

Copy link
Copy Markdown
Collaborator

HIR ty lowering was modified

cc @fmease

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jun 16, 2026
@rustbot

rustbot commented Jun 16, 2026

Copy link
Copy Markdown
Collaborator

r? @davidtwco

rustbot has assigned @davidtwco.
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 73 candidates
  • Random selection from 20 candidates

@rust-log-analyzer

Copy link
Copy Markdown
Collaborator

The job x86_64-gnu-tools failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
...............................F.................. (50/144)
.................................................. (100/144)
............................................       (144/144)

======== tests/rustdoc-gui/go-to-collapsed-elem.goml ========

[ERROR] line 40
    at `tests/rustdoc-gui/go-to-collapsed-elem.goml` line 21: Error: Node is detached from document: for command `click: "//*[@id='search']//a[@href='../test_docs/struct.Foo.html#method.must_use']"`
    at <file:///checkout/obj/build/x86_64-unknown-linux-gnu/test/rustdoc-gui/doc/test_docs/struct.Foo.html?search=t_use>


<= doc-ui tests done: 143 succeeded, 1 failed, 0 filtered out

Error: ()

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

Labels

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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants