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

Split out some cold paths #215

Closed
wants to merge 2 commits into from
Closed

Split out some cold paths #215

wants to merge 2 commits into from

Conversation

SimonSapin
Copy link
Member

No description provided.

@SimonSapin
Copy link
Member Author

@emilio Do you think this would help with https://bugzilla.mozilla.org/show_bug.cgi?id=1632469#c3 ?

Copy link
Member

@emilio emilio left a comment

Choose a reason for hiding this comment

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

I think given the data in that bug it seems likely that this doesn't help. I have a patch where performance is back to normal, and it was due to the change from realloc to alloc.

}

#[cold]
#[inline(never)]
Copy link
Member

Choose a reason for hiding this comment

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

not sure if it's worth the #[inline(never)], tbf.


#[cold]
#[inline(never)]
fn try_reserve_cold(
Copy link
Member

Choose a reason for hiding this comment

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

I'm not really sure about this being tagged as #[cold] unconditionally. There's I suspect a somewhat common usage of:

let mut vec = SmallVec::new();
vec.reserve(num_elements);

for .... {
  vec.push(..);
}

For such cases #[cold] is not accurate, and #[inline(never)] is probably counter-productive.

I think only the caller knows whether the capacity is going to be likely-already enough. For example push() could use the try_reserve_cold without much trouble.

Maybe we should expose both, or something...

impl CollectionAllocErr {
#[cold]
#[inline(never)]
fn bail(&self) -> ! {
Copy link
Member

Choose a reason for hiding this comment

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

#[cold] here looks uncontroversial to me, though maybe the #[inline(never)] prevents stuff from getting potentially optimized away?

@bors-servo
Copy link
Contributor

☔ The latest upstream changes (presumably #229) made this pull request unmergeable. Please resolve the merge conflicts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants