Does excessive linking harm performance?

Avogadro plugins are linked to great bunch of libraries. Is it really needed? Doesn’t it harm performance?

Regards,
Konstantin

Avogadro plugins are linked to great bunch of libraries. Is it really needed? Doesn’t it harm performance?

No, in fact on modern OS, it’s good to have multiple libraries. The virtual memory system will load or unload them as needed. Similarly the idea of a “shared object” library means that multiple programs (or Avogadro plugins) may use the same bits of code. These will be cached, improving performance.

Granted, code shouldn’t like against libraries they don’t use. But linkers are generally smart enough to handle such issues at compile-time.

Cheers,
-Geoff

Avogadro plugins are linked to great bunch of libraries. Is it really needed? Doesn’t it harm performance?
No, in fact on modern OS, it’s good to have multiple libraries. The virtual memory system will load or unload them as needed. Similarly the idea of a “shared object” library means that multiple programs (or Avogadro plugins) may use the same bits of code. These will be cached, improving performance.
Granted, code shouldn’t like against libraries they don’t use. But linkers are generally smart enough to handle such issues at compile-time.

  1. I’ve separated periodic table into library in my Git. But when I’ve added it as dependency for libavogadro, it was linked to all plugins. I’ve removed it and explicitly added to three plugins that need it. Is it OK, or first variant (when it’s linked to everything) is better?
  2. Most of plugins don’t need QtNetwork, but it’s linked everywhere


Regards,
Konstantin

On Mar 31, 2010, at 1:28 PM, Konstantin Tokarev wrote:

  1. I’ve separated periodic table into library in my Git. But when I’ve added it as dependency for libavogadro, it was linked to all plugins. I’ve removed it and explicitly added to three plugins that need it. Is it OK, or first variant (when it’s linked to everything) is better?

I think the explicit dependency is better. (Linking to everything is easier, but it’s better to give explicit linking instructions when possible.)

  1. Most of plugins don’t need QtNetwork, but it’s linked everywhere

We should probably remove that for completeness. The better strategy is likely to require linking to QtNetwork explicitly.

Thanks!
-Geoff

Granted, code shouldn’t like against libraries they don’t use. But linkers are generally smart enough to handle such issues at compile-time.

Probably GNU ld isn’t. ldd shows that plugin libraries are linked to everything they were given at compilation time


Regards,
Konstantin