Why is inlining considered faster than a function call?

前端 未结 16 1561
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-13 04:04

Now, I know it\'s because there\'s not the overhead of calling a function, but is the overhead of calling a function really that heavy (and worth the bloat of having it inli

16条回答
  •  感动是毒
    2020-12-13 04:27

    Optimizing compilers apply a set of heuristics to determine whether or not inlining will be beneficial.

    Sometimes gain from the lack of function call will outweigh the potential cost of the extra code, sometimes not.

提交回复
热议问题