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

perf: Remove inline attribute from into_vec() #71204

Merged
merged 1 commit into from
Apr 18, 2020

Conversation

JohnTitor
Copy link
Member

It was introduced in #70565 and is likely related to this perf results: https://perf.rust-lang.org/compare.html?start=1edcfc83c6a08ddc5e63fc652b149baea0236e7c&end=d249d756374737eb014079901ac132f1e1ed905e&stat=instructions:u
Let's check if it's related to that.
r? @wesleywiser could you kick off perf check? I don't think I can do it.

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Apr 16, 2020
@Xanewok
Copy link
Member

Xanewok commented Apr 16, 2020

@bors try @rust-timer queue

@rust-timer
Copy link
Collaborator

Awaiting bors try build completion

@bors
Copy link
Contributor

bors commented Apr 16, 2020

⌛ Trying commit c2f24a1 with merge 29ffb19116621fbf5394f1486b63a50c529493c5...

@pnkfelix
Copy link
Member

pnkfelix commented Apr 16, 2020

indeed, adding an #[inline] to fn into_vec does seem like it could have widespread effects, since into_vec is the basis of most uses of the vec! macro:

macro_rules! vec {
() => (
$crate::vec::Vec::new()
);
($elem:expr; $n:expr) => (
$crate::vec::from_elem($elem, $n)
);
($($x:expr),+ $(,)?) => (
<[_]>::into_vec(box [$($x),+])
);
}

@bors
Copy link
Contributor

bors commented Apr 16, 2020

☀️ Try build successful - checks-azure
Build commit: 29ffb19116621fbf5394f1486b63a50c529493c5 (29ffb19116621fbf5394f1486b63a50c529493c5)

@rust-timer
Copy link
Collaborator

Queued 29ffb19116621fbf5394f1486b63a50c529493c5 with parent 4e4d49d, future comparison URL.

@rust-timer
Copy link
Collaborator

Finished benchmarking try commit 29ffb19116621fbf5394f1486b63a50c529493c5, comparison URL.

@JohnTitor
Copy link
Member Author

@wesleywiser How about --^?

@wesleywiser
Copy link
Member

wesleywiser commented Apr 17, 2020

Wow! That's definitely the cause of the deep-vector regression. It's a bit unfortunate that we're going to lose those other small speedups but that was the status quo before so I think it's reasonable to return to that.

@bors r+ rollup=never p=1

This fixes an unintended performance regression so I'm bumping the priority so that we see if we need to continue investigating sooner.

@bors
Copy link
Contributor

bors commented Apr 17, 2020

📌 Commit c2f24a1 has been approved by wesleywiser

@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 Apr 17, 2020
@bors
Copy link
Contributor

bors commented Apr 17, 2020

💡 This pull request was already approved, no need to approve it again.

@bors
Copy link
Contributor

bors commented Apr 17, 2020

📌 Commit c2f24a1 has been approved by wesleywiser

@Dylan-DPC-zz
Copy link

@bors retry

@bors
Copy link
Contributor

bors commented Apr 18, 2020

⌛ Testing commit c2f24a1 with merge 9d430cb...

@@ -140,7 +140,6 @@ mod hack {
use crate::string::ToString;
use crate::vec::Vec;

#[inline]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a comment explaining that this is deliberately non-inline and pointing to the perf results in this PR. Otherwise, someone is inadvertently going to add the attribute back in a year or two.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That makes sense, will do!

@bors
Copy link
Contributor

bors commented Apr 18, 2020

☀️ Test successful - checks-azure
Approved by: wesleywiser
Pushing 9d430cb to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Apr 18, 2020
@bors bors merged commit 9d430cb into rust-lang:master Apr 18, 2020
@JohnTitor JohnTitor deleted the into-vec branch April 18, 2020 15:39
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request Apr 18, 2020
Explain why we shouldn't add inline attr to into_vec

Follow-up of rust-lang#71204
r? @RalfJung
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request Apr 18, 2020
Explain why we shouldn't add inline attr to into_vec

Follow-up of rust-lang#71204
r? @RalfJung
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request Apr 18, 2020
Explain why we shouldn't add inline attr to into_vec

Follow-up of rust-lang#71204
r? @RalfJung
@eddyb
Copy link
Member

eddyb commented Apr 21, 2020

Came here from the post-merge perf results for this PR.

I spotted it as the first of the two small post-stabilization regressions in the "clean" runs in this graph.

Sadly the original speedup is before the stabilization so we can't just see it.

@RalfJung
Copy link
Member

So you are saying, while https://perf.rust-lang.org/compare.html?start=4e4d49d60fd696c4036d438292673a2d7fd34519&end=29ffb19116621fbf5394f1486b63a50c529493c5 says this is a speed-up, weirdly that graph shows it as a slow-down?

@eddyb
Copy link
Member

eddyb commented Apr 27, 2020

@RalfJung What you linked has 7 regressions of at least 1.0%, and only 3 speedups.

What's sad is that we can't see the original change that would have roughly the opposite effect (7 speedups and 3 regressions), on graphs, because it happened before the noise was dealt with.

@RalfJung
Copy link
Member

Fair, but the green numbers are bigger than the red ones.

I don't have any stakes in this. But a discussion in an already merged PR is likely to be lost, so IMO if you think something should happen, we should open an issue or just revert the PR or so?

@eddyb
Copy link
Member

eddyb commented Apr 27, 2020

@RalfJung The results are entirely expected as per #71204 (comment).

What I was commenting on is that we can't see how a bunch of crates were marginally sped up in the previous change, with the speed-up being reversed by this PR, because we only fixed the variance halfway in between, so the original change is lost in noise.

There's really nothing to do here, this PR isn't a regression to the state before the original change.

Sorry I wasn't clear enough in my drive-by comment.

@RalfJung
Copy link
Member

Oh I see, thanks for clarifying. :)

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. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants