How much overhead is there in calling a function in C++?

前端 未结 16 1622
予麋鹿
予麋鹿 2020-12-02 07:29

A lot of literature talks about using inline functions to \"avoid the overhead of a function call\". However I haven\'t seen quantifiable data. What is the actual overhead o

16条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-02 08:18

    Each new function requires a new local stack to be created. But the overhead of this would only be noticeable if you are calling a function on every iteration of a loop over a very large number of iterations.

提交回复
热议问题