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

前端 未结 16 1670
予麋鹿
予麋鹿 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:21

    For very small functions inlining makes sense, because the (small) cost of the function call is significant relative to the (very small) cost of the function body. For most functions over a few lines it's not a big win.

提交回复
热议问题