In linux environment, C language, the code of the same library is compiled into static library and dynamic library. Is there any difference in performance?
1. At startup, general dynamic links have better performance.
This is because dynamic link libraries can not be loaded at startup, or they have already been loaded by other programs and need not be loaded into memory again.
2. At runtime, static links generally have better performance.
This is because dynamic link libraries may need to be loaded into memory at runtime. At the same time, for dynamic link library files compiled into address-independent files,
There will be one more step of address calculation and the performance will be slightly worse.
3. In addition, if there is not enough memory, because statically linked files may be less commonly used than dynamically linked files, they are more likely to be swapout, then runtime performance,
Dynamic links may also be better than static links.