Newsgroups: comp.unix.wizards Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!batcomputer!cornell!rochester!kodak!ispd-newsserver!ism.isc.com!ico!rcd From: rcd@ico.isc.com (Dick Dunn) Subject: Re: Shared libraries ... Message-ID: <1991Apr29.232135.9209@ico.isc.com> Organization: Interactive Systems Corporation, Boulder, CO References: <1991Apr19.005739.2321@servalan.uucp> <135@titccy.cc.titech.ac.jp> <73761@brunix.UUCP> Date: Mon, 29 Apr 1991 23:21:35 GMT cgy@cs.brown.edu (Curtis Yarvin) writes: > bzs@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@ico.isc.com -or- ico!rcd Boulder, CO (303)449-2870 ...If you plant ice, you're gonna harvest wind.