Path: utzoo!mnetor!uunet!husc6!bbn!mit-eddie!uw-beaver!cornell!rochester!ur-tut!sunybcs!boulder!michael@boulder.Colorado.EDU From: michael@boulder.Colorado.EDU (Michael Schmidt) Newsgroups: comp.lang.misc Subject: Re: Displays are not expensive (Was: Var scoping in Wirth-type languages) Message-ID: <4818@sigi.Colorado.EDU> Date: 13 Mar 88 18:43:05 GMT References: <3821@ihlpf.ATT.COM> <2791@enea.se> <3949@ihlpf.ATT.COM> <4426@june.cs.washington.edu> <5673@watdragon.waterloo.edu> Sender: news@sigi.Colorado.EDU Reply-To: michael@boulder.Colorado.EDU (Michael Schmidt) Organization: Uni-GH Paderborn, FB17/Informatik Lines: 33 Keywords: static link, go! In-reply-to: gvcormack@watdragon.waterloo.edu (Gordon V. Cormack) Posting-Front-End: Gnews 1.1 In article <5673@watdragon.waterloo.edu> you write: >This is just not true. For ordinary procedure calls, a global >display involves trivial entry and exit overhead. The only time >displays get expensive is if you do lots of "functional" style >programming - passing procedures as parameters and/or using >procedure variables. Carefull. If you have full procedure variables, you even cannot use the usual stack of activation records, because the extent of a procedure doesn't end necessarily, when you leave it. >Even this is quite bearable - it uses time >and space proportional to n to build a local copy of the display >in order to pass a procedure (or procedures) as a parameter. And you have to pass variable length, big objects around. >Here is a comparison of the time to do static links vs. displays. >(in terms of "n", the level of nesting). > > STRATEGY: static links global disply > > ENTRY CODE: O(1) O(1) > EXIT CODE: 0 O(1) > NONLOCAL REF: O(n) O(1) > FUNC PARM: O(1) O(n)* Yes, and now? If you realize, that NONLOCAL REF account for less than ONE PERCENT of all references (if we consider LOCAL-1 to be nearly LOCAL, cf. <4808@sigi.Colorado.EDU>), why should one use displays?? Michael Schmidt