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

do not inline grow_amortized #78483

Closed
wants to merge 1 commit into from
Closed

Conversation

lcnr
Copy link
Contributor

@lcnr lcnr commented Oct 28, 2020

should fix #78471, let's see the impact on perf here though.

@rust-highfive
Copy link
Collaborator

r? @sfackler

(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 Oct 28, 2020
@lcnr
Copy link
Contributor Author

lcnr commented Oct 28, 2020

@bors try @rust-timer queue

@rust-timer
Copy link
Collaborator

Awaiting bors try build completion

@bors
Copy link
Contributor

bors commented Oct 28, 2020

⌛ Trying commit 2872b5f with merge e3fea320f3cbd44a96c08637c2005cee1cae6dcc...

@@ -389,6 +389,9 @@ impl<T, A: AllocRef> RawVec<T, A> {
// so that all of the code that depends on `T` is within it, while as much
// of the code that doesn't depend on `T` as possible is in functions that
// are non-generic over `T`.
//
// We never inline this function to keep `Vec::push` small.
#[inline(never)]
Copy link
Member

@m-ou-se m-ou-se Oct 28, 2020

Choose a reason for hiding this comment

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

In many places, #[cold] is used for this, sometimes together with #[inline(never)] on the same function. Is there some guidance somewhere on which to use where?

If these kind of functions should have #[inline(never)] instead of (or in addition to) #[cold], some of them (e.g. SyncOnceCell::initialize) should probably be updated.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

hmm, I am not really sure. It probably depends on where it is used and we would need an additional perf run 😆

I do feel like this method is kind of special as it is extremely frequently used. Not sure if SyncOnceCell is used frequently enough for this to be noticeable. Could be worth trying though

@bors
Copy link
Contributor

bors commented Oct 28, 2020

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

@rust-timer
Copy link
Collaborator

Queued e3fea320f3cbd44a96c08637c2005cee1cae6dcc with parent 2eb4fc8, future comparison URL.

@rust-timer
Copy link
Collaborator

Finished benchmarking try commit (e3fea320f3cbd44a96c08637c2005cee1cae6dcc): comparison url.

Benchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. Please note that if the perf results are neutral, you should likely undo the rollup=never given below by specifying rollup- to bors.

Importantly, though, if the results of this run are non-neutral do not roll this PR up -- it will mask other regressions or improvements in the roll up.

@bors rollup=never
@rustbot modify labels: +S-waiting-on-review -S-waiting-on-perf

@lcnr
Copy link
Contributor Author

lcnr commented Oct 28, 2020

looking at the perf cost this does not seem desirable to me

@lcnr lcnr closed this Oct 28, 2020
@glandium
Copy link
Contributor

Can you try never inlining finish_grow? because it appears to always be inlined.

@lcnr
Copy link
Contributor Author

lcnr commented Oct 28, 2020

won't do so myself, but feel free to open a PR doing this and assign me using r? @lcnr and we can then look at the perf results for that

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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Code bloat from RawVec::grow_amortized
7 participants