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

Reduce code size of assert_matches_failed #100933

Merged
merged 1 commit into from
Aug 26, 2022

Conversation

a1phyr
Copy link
Contributor

@a1phyr a1phyr commented Aug 23, 2022

Using write_str instead of <str as Display>::fmt avoids the pad function which is very expensive to have in size-constrained code.

@rustbot rustbot added the T-libs Relevant to the library team, which will review and decide on the PR/issue. label Aug 23, 2022
@rust-highfive
Copy link
Collaborator

r? @joshtriplett

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Aug 23, 2022
@joshtriplett
Copy link
Member

@bors r+ rollup=never

@bors
Copy link
Contributor

bors commented Aug 24, 2022

📌 Commit 289d7cc has been approved by joshtriplett

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 Aug 24, 2022
@nnethercote
Copy link
Contributor

@bors try @rust-timer queue

@rust-timer
Copy link
Collaborator

Awaiting bors try build completion.

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

@bors
Copy link
Contributor

bors commented Aug 24, 2022

🙅 Please do not try after a pull request has been r+ed. If you need to try, unapprove (r-) it first.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Aug 24, 2022
@nnethercote
Copy link
Contributor

I'd like a perf run before this lands. The merge queue is very long right now, so it won't delay things.

@bors r-

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Aug 24, 2022
@nnethercote
Copy link
Contributor

@bors try @rust-timer queue

@rust-timer
Copy link
Collaborator

Awaiting bors try build completion.

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

@bors
Copy link
Contributor

bors commented Aug 24, 2022

⌛ Trying commit 289d7cc with merge e935756a38fbc6620cbc9d1d14252f7cb0973460...

@a1phyr
Copy link
Contributor Author

a1phyr commented Aug 24, 2022

This is very unlikely to have any effect on compilation perf, this function is only instatiated once.

@nnethercote
Copy link
Contributor

The perf runs also measure binary size, which I think this PR will affect? At least, that's my understanding of the description. I'm not sure why @joshtriplett marked this as rollup=never.

@bors
Copy link
Contributor

bors commented Aug 24, 2022

☀️ Try build successful - checks-actions
Build commit: e935756a38fbc6620cbc9d1d14252f7cb0973460 (e935756a38fbc6620cbc9d1d14252f7cb0973460)

@rust-timer
Copy link
Collaborator

Queued e935756a38fbc6620cbc9d1d14252f7cb0973460 with parent ebfc7aa, future comparison URL.

@joshtriplett
Copy link
Member

The perf runs also measure binary size, which I think this PR will affect? At least, that's my understanding of the description. I'm not sure why @joshtriplett marked this as rollup=never.

I marked it as rollup=never because it seemed like it might have an impact on generated code size in a way that would be nice to have separated from a rollup.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (e935756a38fbc6620cbc9d1d14252f7cb0973460): comparison URL.

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

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

Instruction count

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

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.

mean1 range count2
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
2.5% [2.4%, 2.6%] 2
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) - - 0

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.

mean1 range count2
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-2.9% [-2.9%, -2.9%] 1
Improvements ✅
(secondary)
-2.5% [-2.8%, -2.2%] 2
All ❌✅ (primary) -2.9% [-2.9%, -2.9%] 1

Footnotes

  1. the arithmetic mean of the percent change 2

  2. number of relevant changes 2

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Aug 24, 2022
@nnethercote
Copy link
Contributor

The perf results show no changes to speed, memory usage, or binary size. The code is a little simpler, which is nice, but there's no evidence this will help size-constrained code.

@bors r=JoshTriplett

@bors
Copy link
Contributor

bors commented Aug 25, 2022

📌 Commit 289d7cc has been approved by JoshTriplett

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. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Aug 25, 2022
@nnethercote
Copy link
Contributor

@bors rollup=always

Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request Aug 25, 2022
…r=JoshTriplett

Reduce code size of `assert_matches_failed`

Using `write_str` instead of `<str as Display>::fmt` avoids the `pad` function which is very expensive to have in size-constrained code.
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request Aug 25, 2022
…r=JoshTriplett

Reduce code size of `assert_matches_failed`

Using `write_str` instead of `<str as Display>::fmt` avoids the `pad` function which is very expensive to have in size-constrained code.
JohnTitor added a commit to JohnTitor/rust that referenced this pull request Aug 25, 2022
…r=JoshTriplett

Reduce code size of `assert_matches_failed`

Using `write_str` instead of `<str as Display>::fmt` avoids the `pad` function which is very expensive to have in size-constrained code.
bors added a commit to rust-lang-ci/rust that referenced this pull request Aug 26, 2022
Rollup of 8 pull requests

Successful merges:

 - rust-lang#99064 (distinguish the method and associated function diagnostic information)
 - rust-lang#99920 (Custom allocator support in `rustc_serialize`)
 - rust-lang#100034 ( Elaborate all box dereferences in `ElaborateBoxDerefs`)
 - rust-lang#100076 (make slice::{split_at,split_at_unchecked} const functions)
 - rust-lang#100604 (Remove unstable Result::into_ok_or_err)
 - rust-lang#100933 (Reduce code size of `assert_matches_failed`)
 - rust-lang#100978 (Handle `Err` in `ast::LitKind::to_token_lit`.)
 - rust-lang#101010 (rustdoc: remove unused CSS for `.multi-column`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 6849555 into rust-lang:master Aug 26, 2022
@rustbot rustbot added this to the 1.65.0 milestone Aug 26, 2022
@a1phyr a1phyr deleted the cheap_assert_match_failed branch March 12, 2024 17:12
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-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

7 participants