Static inline functions: best practices?

Is there a rule of thumb as to when we would use a static inline function in the header file versus a normal function in the .c file?

I found this here:

The point of making a function inline is to hint to the compiler that it is worth making some form of extra effort to call the function faster than it would otherwise - generally by substituting the code of the function into its caller. As well as eliminating the need for a call and return sequence, it might allow the compiler to perform certain optimizations between the bodies of both functions.

So it’s worth making something a static inline function when it is likely to be called often? (And/or rather short?)

Hmmm, I think that’s not the real reason you make a function static inline. I mean, that’s the side effect of it, but IIRC the purpose of static inline is as an alternative to #define to create inlined but untyped and unmanaged functions. So it’s supposed to generate the code at that point, but also work exactly like you called the function on the stack. The advantage over #define is that it’s easier to manage and it has the correct type checking.

Speed is a side effect, but if you’re slapping it on randomly to speed things up then that’s not the best way to improve speed. It’s better to write the code as simply as possible to make sure it’s very very correct, then profile it and use data to figure out how to improve its speed.