How deep do compilers inline functions?

前端 未结 2 2519
独厮守ぢ
独厮守ぢ 2021-01-01 20:15

Say I have some functions, each of about two simple lines of code, and they call each other like this: A calls B calls C calls D

2条回答
  •  感动是毒
    2021-01-01 20:32

    I've seen compilers inline more than 5 functions deep. But at some point, it basically becomes a space-efficiency trade-off that the compiler makes. Every compiler is different in this aspect. Visual Studio is very conservative with inlining. GCC (under -O3) and the Intel Compiler love to inline...

提交回复
热议问题