Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!mcvax!ukc!stc!root44!aegl From: aegl@root.co.uk (Tony Luck) Newsgroups: comp.arch,comp.os.misc Subject: Re: Shared libraries (Was: Re: Big Programs Hurt Performance) Message-ID: <439@root44.co.uk> Date: Mon, 5-Oct-87 14:38:53 EDT Article-I.D.: root44.439 Posted: Mon Oct 5 14:38:53 1987 Date-Received: Mon, 12-Oct-87 22:34:08 EDT References: <6886@eddie.MIT.EDU) <2501@xanth.UUCP> <2067@sfsup.UUCP> <443@devvax.JPL.NASA.GOV> <2114@sfsup.UUCP> Reply-To: aegl@root44.UUCP (Tony Luck) Organization: Root Computers Ltd, London, England Lines: 37 Xref: mnetor comp.arch:2606 comp.os.misc:284 In article <2114@sfsup.UUCP> shap@sfsup.UUCP (J.S.Shapiro) writes: >There is a technique which can be used to avoid all this which is to have >an indirection table and a directory in each library, or a >well-known-globals list, as someone suggested, but this implies a >remarkable performance hit. On many architectures I wouldn't call this a "remarkable" performance hit consider the humble 68000 - and a scheme that involves a "jsr" to a known location in a jump table within the shared library which then does a "jmp" to the real function. Thus a typical function call will do at least jsr 20 cycles jmp 12 cycles rts 16 cycles so a null function will waste 12 out of 48 cycles i.e. 25% - this *is* a "remarkable" performance hit ... but consider a real function with some local stack frame to set up and 3 registers to save/restore: jsr 20 cycles jmp 12 cycles link 18 cycles movm 38 cycles : movm 38 cycles unlk 12 cycles rts 16 cycles Here the overhead is 12 cycles out of 154 i.e. just under 8% - still bad, bu not a complete disaster - and we still haven't counted any cycles for the function doing anything at all useful just a fairly typical function call overhead. I guess that this general overhead will not be hugely different on other architectures. -Tony Luck (Porting manager - Root Computers Ltd., London)