Shared libraries (was Re: Window system bashing (was Re: X11 bashing))

Barry Shein bzs at world.std.com
Sun May 5 11:29:41 AEST 1991


From: cgy at cs.brown.edu (Curtis Yarvin)
>>Try running some job using shared and statically linked libraries on
>>various systems. 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.
>
>Dynamically linked shared libraries (a la Sun) will incur a performance hit,
>but it is completely misleading to talk about the hit in percentage terms.
>The linking occurs either at initial runtime or when the linked function is
>called.  In the former case, the cost is dependent on the number of
>libraries linked with; in the latter (I'm not sure which systems use this -
>maybe none), it is dependent on the number of library functions called.

Have you actually made any attempt to measure this effect? Or are you
just drawing conclusions from a few facts you have lying around?

I have been doing some measuring. For an easy laboratory, try
compiling dhrystone 2.1 static and dynamic on various systems and see
how many dhrystones you get on each. Vary the number of runs through
the program also, should give some feeling as to whether or not there
is an asymptote.

There are other effects here than sheer code count, most noticeably
instruction cache flushing due to either branches or even
self-modifying code (I haven't even thought about code locality as I'm
purposely looking at small programs which shouldn't page.)

But the lesson may be: Two things which are different are rarely the
same.  And they may be different in more ways than you first think.

As I said, it depends a lot on the implementation (both software and
hardware), finding systems which vary little can not be generalized.

Some systems will show little difference, some may show 50% or more
performance drops. The latter are probably correctable, although
unless you have source or even access to the cache designs this may be
difficult.

>Barry Shein is a very intelligent person and no doubt knows this.

Indeed, that's a good reason to be much more careful when criticizing :-)
-- 
        -Barry Shein

Software Tool & Die    | bzs at world.std.com          | uunet!world!bzs
Purveyors to the Trade | Voice: 617-739-0202        | Login: 617-739-WRLD



More information about the Comp.unix.wizards mailing list