Remove unnecessary #[inline] hints#3867
Remove unnecessary #[inline] hints#3867daxpedda wants to merge 1 commit intorust-windowing:masterfrom
#[inline] hints#3867Conversation
|
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.
Small public function calling public code? All of these, it seems like?
There was a problem hiding this comment.
Emphasis on non-generic.
There was a problem hiding this comment.
Let's wake up and try reading this again after a few hours 🙈.
Yes! |
madsmtm
left a comment
There was a problem hiding this comment.
Wow. that's a lot of #[inline] that we've been using
kchibisov
left a comment
There was a problem hiding this comment.
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.