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 core debug assertion helpers #113687

Merged
merged 1 commit into from
Jul 24, 2023

Conversation

saethlin
Copy link
Member

These functions are called a lot and not inlined by default in a dev compiler. Adding #[inline] should improve things in a dev workflow and be irrelevant in the distributed library.

@rustbot
Copy link
Collaborator

rustbot commented Jul 14, 2023

r? @cuviper

(rustbot has picked a reviewer for you, use r? to override)

@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 Jul 14, 2023
@cuviper
Copy link
Member

cuviper commented Jul 21, 2023

irrelevant in the distributed library.

I guess we're not set up to perf test it then, but it makes sense to me!

@bors r+

@bors
Copy link
Contributor

bors commented Jul 21, 2023

📌 Commit 9d4a8e4dc5661125fe3f6b0abde369996d5f0127 has been approved by cuviper

It is now in the queue for this repository.

@bors bors 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 Jul 21, 2023
@matthiaskrgr
Copy link
Member

@bors rollup=never

@bors
Copy link
Contributor

bors commented Jul 22, 2023

⌛ Testing commit 9d4a8e4dc5661125fe3f6b0abde369996d5f0127 with merge 88e1282e2e1ca906a8d2c1636b669b0e3dc63cd5...

@rust-log-analyzer

This comment has been minimized.

@bors
Copy link
Contributor

bors commented Jul 22, 2023

💔 Test failed - checks-actions

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Jul 22, 2023
@cuviper
Copy link
Member

cuviper commented Jul 24, 2023

@bors r+

@bors
Copy link
Contributor

bors commented Jul 24, 2023

📌 Commit 65e52bb has been approved by cuviper

It is now in the queue for this repository.

@bors bors 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 Jul 24, 2023
@bors
Copy link
Contributor

bors commented Jul 24, 2023

⌛ Testing commit 65e52bb with merge 31395ec...

@bors
Copy link
Contributor

bors commented Jul 24, 2023

☀️ Test successful - checks-actions
Approved by: cuviper
Pushing 31395ec to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Jul 24, 2023
@bors bors merged commit 31395ec into rust-lang:master Jul 24, 2023
11 checks passed
@rustbot rustbot added this to the 1.73.0 milestone Jul 24, 2023
@saethlin saethlin deleted the inline-assertion-helpers branch July 24, 2023 23:26
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (31395ec): comparison URL.

Overall result: ❌✅ regressions and improvements - ACTION NEEDED

Next Steps: If you can justify the regressions found in this perf run, please indicate this with @rustbot label: +perf-regression-triaged along with sufficient written justification. If you cannot justify the regressions please open an issue or create a new PR that fixes the regressions, add a comment linking to the newly created issue or PR, and then add the perf-regression-triaged label to this PR.

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

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)
0.7% [0.6%, 0.7%] 2
Regressions ❌
(secondary)
0.5% [0.3%, 0.6%] 5
Improvements ✅
(primary)
-0.2% [-0.3%, -0.2%] 3
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.1% [-0.3%, 0.7%] 5

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

Cycles

This benchmark run did not return any relevant results for this metric.

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
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.2% [-0.4%, -0.0%] 70
Improvements ✅
(secondary)
-0.1% [-0.2%, -0.0%] 15
All ❌✅ (primary) -0.2% [-0.4%, -0.0%] 70

Bootstrap: 652.459s -> 650.065s (-0.37%)

@rustbot rustbot added the perf-regression Performance regression. label Jul 25, 2023
@nnethercote
Copy link
Contributor

The small number of icount regressions are inconsequential. The large number of binary size reductions are very nice.

@rustbot label: +perf-regression-triaged

@rustbot rustbot added the perf-regression-triaged The performance regression has been triaged. label Jul 25, 2023
@saethlin
Copy link
Member Author

I'm shocked this matters at all. Aren't all these functions trivially unreachable and optimized out in a release build of the standard library? I mean, the mir-opt test change suggests that some bits of them remain, which is disconcerting for sure.

@therealprof
Copy link
Contributor

therealprof commented Jul 25, 2023

I'm shocked this matters at all. Aren't all these functions trivially unreachable and optimized out in a release build of the standard library? I mean, the mir-opt test change suggests that some bits of them remain, which is disconcerting for sure.

Not sure. I've been complaining a lot about the subideal inlining in libcore for years since this has been a critical problem for folks who want to write embedded code and debug it, too, because the produced binaries without optimisation are so ginormous that they don't even fit in flash. And if they do, they're often running so slow that some strict timing requirements of some hardware can't be fulfilled.

And no, embedded developers pretty much never care about debugging libcore on microcontrollers, so it doesn't make sense to generate easily debuggable and super-slow code for trivial operations -- at least not by default as it is now.

@saethlin
Copy link
Member Author

I don't think any of what you have said is relevant to the perf results above. All the perf numbers above are using the precompiled standard library, which has debug assertions disabled.

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. perf-regression-triaged The performance regression has been triaged. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. 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.

9 participants