Shared libraries ...

Dick Dunn rcd at ico.isc.com
Tue Apr 30 09:21:35 AEST 1991


cgy at cs.brown.edu (Curtis Yarvin) writes:
> bzs at world.std.com (Barry Shein) writes:
> >...Shared libraries
> >also incur a performance hit which varies on different systems (and
> >applications on the same system, for example.)
...
> >...I've seen from 5-10% to 75% performance degradations
> >(granted the last was odd enough to look into, but it was there.)

> This is true, but 99.97% bogus.
> 
> Statically linked shared libraries should incur little or no performance hit.

Depends on how calls to library routines work.  A simplistic implementation
would just slap in the address in the shared region--but that's a main-
tenance headache.  Either you have to coreograph some elaborate song-and-
dance with padding so addresses don't move, or applications have to be
bound to a particular instance of a shared library.  (Remember, this is
under the static-link assumption.)

If you decouple addressing into the shared library with transfer vectors
(and/or linkage vectors for data) the indirection will cost real execution
time, and the cost occurs per call (or reference).

[Curtis then discusses dynamic-linking costs as incurred at the time the
linking is done]

> Either way, the cost is CONSTANT relative to the execution time of the
> program...

Only if references into shared-library code have the same form as local/
private references.  It is common (tho by no means universal) that they
do not.

> Thus it is utterly misleading to talk about the performance cost of shared
> libraries in percentage terms.
> 
> Barry Shein is a very intelligent person and no doubt knows this.

Perhaps Barry is intelligent enough to know not only what you said, but a
little bit more, about cases where there is an execution-time cost?
-- 
Dick Dunn     rcd at ico.isc.com -or- ico!rcd       Boulder, CO   (303)449-2870
   ...If you plant ice, you're gonna harvest wind.



More information about the Comp.unix.wizards mailing list