Skip to content
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

Add #[inline] to Option::copied/cloned #122313

Closed
wants to merge 1 commit into from

Conversation

erikdesjardins
Copy link
Contributor

In #121665 (comment), I noticed that Option::cloned stopped being inlined in some backtrace code. Let's see if this helps.

r? @ghost

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Mar 10, 2024
@Kobzol
Copy link
Contributor

Kobzol commented Mar 10, 2024

@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 Mar 10, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 10, 2024
Add #[inline] to Option::copied/cloned

In rust-lang#121665 (comment), I noticed that `Option::cloned` stopped being inlined in some backtrace code. Let's see if this helps.

r? `@ghost`
@bors
Copy link
Contributor

bors commented Mar 10, 2024

⌛ Trying commit e937802 with merge 18157f4...

@bors
Copy link
Contributor

bors commented Mar 10, 2024

☀️ Try build successful - checks-actions
Build commit: 18157f4 (18157f4cb679fb8de0ea6cabeeae014f191ef2d4)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (18157f4): comparison URL.

Overall result: ❌✅ regressions and improvements - ACTION NEEDED

Benchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR may lead to changes in compiler perf.

Next Steps: If you can justify the regressions found in this try perf run, please indicate this with @rustbot label: +perf-regression-triaged along with sufficient written justification. If you cannot justify the regressions please fix the regressions and do another perf run. If the next run shows neutral or positive results, the label will be automatically removed.

@bors rollup=never
@rustbot label: -S-waiting-on-perf +perf-regression

Instruction count

This is a highly reliable metric that was used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
6.4% [6.4%, 6.4%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-1.4% [-2.6%, -0.4%] 3
Improvements ✅
(secondary)
-2.3% [-2.3%, -2.3%] 1
All ❌✅ (primary) 0.6% [-2.6%, 6.4%] 4

Max RSS (memory usage)

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
5.5% [2.5%, 9.2%] 4
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-3.1% [-3.1%, -3.1%] 1
Improvements ✅
(secondary)
-2.3% [-2.3%, -2.3%] 1
All ❌✅ (primary) 3.8% [-3.1%, 9.2%] 5

Cycles

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
6.2% [6.2%, 6.2%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-2.3% [-2.3%, -2.3%] 1
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 2.0% [-2.3%, 6.2%] 2

Binary size

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
0.2% [0.0%, 0.3%] 4
Regressions ❌
(secondary)
1.3% [1.3%, 1.3%] 1
Improvements ✅
(primary)
-0.2% [-0.5%, -0.0%] 6
Improvements ✅
(secondary)
-0.0% [-0.0%, -0.0%] 8
All ❌✅ (primary) -0.0% [-0.5%, 0.3%] 10

Bootstrap: 647.057s -> 646.753s (-0.05%)
Artifact size: 309.92 MiB -> 309.96 MiB (0.01%)

@rustbot rustbot added perf-regression Performance regression. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Mar 11, 2024
@erikdesjardins
Copy link
Contributor Author

Well, it does cause Option::cloned to be inlined, but it doesn't make things any smaller:

Stats for benchmark `helloworld`
--------------------
Target `helloworld` (artifact `helloworld`)
┌─────────────────────┬───────────────┬──────────────┬──────┬──────────┐
│ Section             │ Size (before) │ Size (after) │ Diff │ Diff (%) │
├─────────────────────┼───────────────┼──────────────┼──────┼──────────┤
│ .rodata             │     24.21 KiB │    24.40 KiB │ +192 │    +0.8% │
│ .strtab             │     47.21 KiB │    47.14 KiB │  -64 │    -0.1% │
│ .symtab             │     17.46 KiB │    17.44 KiB │  -24 │    -0.1% │
│ .eh_frame           │     24.29 KiB │    24.27 KiB │  -16 │    -0.1% │
│ .eh_frame_hdr       │      3.86 KiB │     3.86 KiB │   -8 │    -0.2% │
│ <27 unchanged rows> │    284.10 KiB │   284.10 KiB │    0 │     0.0% │
│─────────────────────│───────────────│──────────────│──────│──────────│
│ Total               │    401.13 KiB │   401.21 KiB │  +80 │    +0.0% │
└─────────────────────┴───────────────┴──────────────┴──────┴──────────┘
┌──────────────────────────────────┬───────────────┬──────────────┬──────┬──────────┐
│ Symbol                           │ Size (before) │ Size (after) │ Diff │ Diff (%) │
├──────────────────────────────────┼───────────────┼──────────────┼──────┼──────────┤
│ addr2line::render_file           │         956 B │     1.10 KiB │ +175 │   +18.3% │
│ core::option::Option<&T>::cloned │         174 B │          0 B │ -174 │  -100.0% │
│ <694 unchanged rows>             │    250.89 KiB │   250.89 KiB │    0 │     0.0% │
│──────────────────────────────────│───────────────│──────────────│──────│──────────│
│ Total                            │    251.99 KiB │   252.00 KiB │   +1 │    +0.0% │
└──────────────────────────────────┴───────────────┴──────────────┴──────┴──────────┘

Stats for benchmark `helloworld-tiny`
--------------------
Target `helloworld-tiny` (artifact `helloworld-tiny`)
┌─────────────────────┬───────────────┬──────────────┬───────┬──────────┐
│ Section             │ Size (before) │ Size (after) │  Diff │ Diff (%) │
├─────────────────────┼───────────────┼──────────────┼───────┼──────────┤
│ .text               │    223.94 KiB │   225.25 KiB │ +1344 │    +0.6% │
│ .rodata             │     21.77 KiB │    21.96 KiB │  +192 │    +0.9% │
│ .strtab             │     35.80 KiB │    35.80 KiB │    +1 │    +0.0% │
│ <29 unchanged rows> │     62.39 KiB │    62.39 KiB │     0 │     0.0% │
│─────────────────────│───────────────│──────────────│───────│──────────│
│ Total               │    343.90 KiB │   345.40 KiB │ +1537 │    +0.4% │
└─────────────────────┴───────────────┴──────────────┴───────┴──────────┘
┌────────────────────────┬───────────────┬──────────────┬───────┬──────────┐
│ Symbol                 │ Size (before) │ Size (after) │  Diff │ Diff (%) │
├────────────────────────┼───────────────┼──────────────┼───────┼──────────┤
│ addr2line::render_file │         968 B │     2.26 KiB │ +1349 │  +139.4% │
│ <495 unchanged rows>   │    225.45 KiB │   225.45 KiB │     0 │     0.0% │
│────────────────────────│───────────────│──────────────│───────│──────────│
│ Total                  │    226.40 KiB │   227.72 KiB │ +1349 │    +0.6% │
└────────────────────────┴───────────────┴──────────────┴───────┴──────────┘

(from ./target/release/collector binary_stats +af69f4c48c1e1cfbb9ba43b376edcfbdd8cfbca4 --rustc2 +18157f4cb679fb8de0ea6cabeeae014f191ef2d4 --include helloworld --profile Opt --backend Llvm --symbols)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
perf-regression Performance regression. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants