In my experience, the inline
keyword is mainly useful in two situations:
It lets you write generic numeric code which would not be possible without
inline
. So in this case, you need inlining regardless of the performance concerns.I think that generic comparison (see also this SO question) is the main use case where
inline
significantly improves performance (because the inlined code can be specialized for the current type rather than using generic comparison).
In all other cases, adding inline
might make code a little bit faster, but probably won't have significant effect. So I would only use it when you are actually optimizing some bottleneck.