-
Notifications
You must be signed in to change notification settings - Fork 146
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
Conversation
@emilio Do you think this would help with https://bugzilla.mozilla.org/show_bug.cgi?id=1632469#c3 ? |
There was a problem hiding this 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)] |
There was a problem hiding this comment.
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( |
There was a problem hiding this comment.
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) -> ! { |
There was a problem hiding this comment.
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?
☔ The latest upstream changes (presumably #229) made this pull request unmergeable. Please resolve the merge conflicts. |
No description provided.