Is there any additional overhead for calling a function in a separate compilation unit?

I know that there is more overhead of calling a function in DSO due to double jump. Is there any additional overhead when calling a function in a separate compilation module compared to calling one of the same compilation module (assuming that in both cases it is not inserted)?

+4
source share
2 answers

Generally speaking, they will be the same, not countin inlays or other global optimization features. But depending on the architecture, there may be subtle differences.

, Linux/Unix CU, :

void foo() {}
void bar()
{ foo(); }

:

static void foo() {}
void bar()
{ foo(); }

( !), foo() (, LD_LIBRARY_PRELOAD), . , , CU, .

Windows, , , LD_LIBRARY_PRELOAD, .

+4

, , - , ( ).

0

Source: https://habr.com/ru/post/1543962/


All Articles