O'Reilly logo
  • LI WEI thinks this is interesting:

Everywhere this max function is used, the code for the function body will be copied and pasted at the point of the function call. Not having to jump to the function saves execution time, making inline functions effectively similar to macros.

From

Cover of Learning C++ by Creating Games with UE4

Note

Inline 函数在执行的时候直接将代码复制到调用的函数内部。而一般函数会调用函数栈进行跳转,会消耗一定的性能。然而inline适用一些多次会被调用到的迷你函数。