Reputation: 23
is it possible to have better performance in the code with all routines within the same library.
or, to rephrase it, does the performance of the code get degraded when some part of the code is moved into another library?
Upvotes: 0
Views: 141
Reputation: 3246
Question, would your program be running only once or would be run frequently?
If its the former, and if we assume the shared libraries are not in memory then yes, the static binary would have slight increase in performance that too only by a matter of milli-seconds.
Most likely if you are linking against libc or msvcrt (on Windows) those are already in memory and you don't save much anyways other than just having a huge binary.
Let us consider the latter case ... I don't think that the performance improvements are worthwhile to statically build and have a huge binary. If your applications uses common shared libraries (or DLLs), then all of those libraries would have been loaded in memory already.
Hope that helps.
See here for additional responses Static vs. Dynamic Library Performance.
Upvotes: 2