Closed luojia65 closed 6 months ago
r? @bugadani
I don't think this should be the default. Could we feature-gate it? I suspect it might be a net negative in some cases to inline.
I might be wrong but as far as I know generic code is inline by default anyway. Do you have some example where it is not?
In general I'm not against adding #[inline]
to public API, and I believe it is also encouraged generally (clippy has a lint for it, for example). But this is generic code so I'm not sure what the results are, so it would be nice to know some specific cases where it helps (and where it hurts, too!)
For new
and release
this is a no brainer. For others, like send_command
and send_data
those functions may just be large enough anyway for the compiler to not consider inlining them.
it will perform better
Do you have numbers that support this claim? How much better, in what cases?
Could we feature-gate it?
Please don't. #[inline]
is a hint and not a guarantee, so that feature gate may or may not do anything and it would be very confusing.
This pull request adds #[inline] to most of the functions; it will perform better on bare-metal programs.