Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!wuarchive!swbatl!texbell!texsun!pollux!ti-csl!islington-terrace.csc.ti.com From: pf@islington-terrace.csc.ti.com (Paul Fuqua) Newsgroups: comp.lang.lisp Subject: Re: CLOS speed Message-ID: <96030@ti-csl.csc.ti.com> Date: 27 Oct 89 17:09:12 GMT References: <31037@news.Think.COM> Sender: news@ti-csl.csc.ti.com Organization: TI Computer Science Center, Dallas, Texas Lines: 52 Moon: Waning Crescent (3% of full) Date: Wednesday, October 25, 1989 1:41am (CDT) From: barmar at kulla (Barry Margolin) Subject: Re: CLOS speed Newsgroups: comp.lang.lisp Symbolics announced in the Summer that their next release, which should be released this winter, will include CLOS. I suspect Lucid and Franz will be including CLOS by the summer. TI includes CLOS in their (our) Release 6.0, which I believe started shipping last week. Note that you shouldn't expect generic function calls to be as efficient as normal function calls. Remember that CLOS provides extra functionality per line of code. Naturally, there are some tradeoffs. Since the sequence of events will be something like (1) call the generic function, (2) look up the method, (3) call the method, a generic function call will take about 2x the time for a regular function call, plus method-lookup overhead. On my Explorer, I'm seeing 3x or 4x for simple one-argument dispatches. Method-lookup overhead can be reduced by caching methods, and some of the function-call overhead can be reduced by avoiding duplicate work for the second call. A really hot compiler might do the method-lookup at compile time if it had enough type information, but I don't think anyone does that yet. Date: Wednesday, October 25, 1989 10:03pm (CDT) From: barmar at kulla (Barry Margolin) Subject: Re: CLOS speed Newsgroups: comp.lang.lisp Accessing a local variable is probably the fastest single operation in any Lisp implementation. CLOS slots should be compared with DEFSTRUCT slots, not with local variables. In a high performance implementation, with type declarations and block compilation, the offset can be determined at compile time, and most of the above can be compiled away or inlined. Another off-the-cuff Explorer example: SLOT-VALUE with no type information takes about 50x a DEFSTRUCT slot reference, SLOT-VALUE with type information takes 25x, an accessor method takes 13x, and WITH-SLOTS within a method takes 4x or 5x. Sometimes I've found it useful to make a function into a method just to improve the slot-access performance. Paul Fuqua pf@csc.ti.com {smu,texsun,cs.utexas.edu,rice}!ti-csl!pf Texas Instruments Computer Science Center PO Box 655474 MS 238, Dallas, Texas 75265