-
Notifications
You must be signed in to change notification settings - Fork 909
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
Remove unnecessary #[inline]
hints
#3867
base: master
Are you sure you want to change the base?
Conversation
Fwiw, in So I hope you're leaving public functions that call public functions/constructors in place? |
#[inline] | ||
pub fn cast<X: Pixel>(&self) -> LogicalUnit<X> { | ||
LogicalUnit(self.0.cast()) |
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.
Small public function calling public code? All of these, it seems like?
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.
Emphasis on non-generic.
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.
Let's wake up and try reading this again after a few hours 🙈.
Yes! |
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.
Wow. that's a lot of #[inline]
that we've been using
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 keep my approval.
Will just like to hold it until we merge like big PRs, since this one was pretty much done automatically(I hope so) and can be regenerated when needed.
As discussed in the last meeting, this PR removes unnecessary
#[inline]
hints, which hurt compile times and sometimes even performance.To summarize:
#[inline]
to generic functions is not recommended.#[inline]
to non-public functions is not recommended.#[inline]
to public functions because they only call a private function is not recommended, unless that private function is small and is annotated with#[inline]
as well.#[inline]
should only be used for small non-generic public functions or after some benchmarking.See https://matklad.github.io/2021/07/09/inline-in-rust.html and rust-lang/hashbrown#119 (comment) for more detailed information and recommendations.