This is partly a historical issue. Once there were only static libraries. They were statically linked to each binary system compiled by the system. However, this was a maintenance nightmare, among other things, requiring that all used packages be recompiled if the library was fixed or changed.
Then shared libraries were used to fix these problems. Now for your question, firstly, there are several significant optimizations that can occur in a statically linked library that cannot be performed on a dynamic one, so even if someone had to convert dynamic libraries to static ones, this would probably be less efficient than statically compiled code in the first place.
Secondly, most modern systems use exclusively shared libraries anyway, so the problem is not very big, things are compiled only once, like a shared library.
As an insignificant stretch, however, it is relevant, you can take a look at prelinking . A step that removes some of the initial overhead (although it still doesn't necessarily achieve the same performance as a static link) and allows software that is dynamically linked in libraries to run faster.
source share