[comp.lang.clos] Speed of generic calls

djk@cs.columbia.edu (David Kurlander) (11/15/90)

Howdy folks,

Currently I'm using my own object-oriented constructs with Common
Lisp, but I would like to switch to CLOS because of the greater
flexibility and ease of use.  My one concern is the speed of generic
calls.  In the versions of CLOS that you use, how does the speed of
generic calls compare to that of vanilla function calls?  I'm
particularly interested in versions of Common Lisp that run on Sun
4's.

Thanks,
David
-- 
----------------------------------
David Kurlander				Department of Computer Science
djk@cs.columbia.edu			Columbia University

gregor@parc.xerox.com (Gregor Kiczales) (11/17/90)

   From: djk@cs.columbia.edu (David Kurlander)
   Date: 14 Nov 90 18:08:48 GMT
	   
   In the versions of CLOS that you use, how does the speed of
   generic calls compare to that of vanilla function calls?  I'm
   particularly interested in versions of Common Lisp that run on
   Sun 4's.

To begin with the usual caveat, you have to watch out a bit for this
ratio.  It is, for example, easy to make generic function calls faster
than ordinary function calls simply by "appropriately adjusting" the
implementation of ordinary function calls.

That said, CLOS implemtations can do pretty well on this benchmark.
Even in PCL, the portable implementation of CLOS developed at PARC, we
were able to obtain good numbers.  For reader generic functions (those
that call automatically generated reader methods) we ended up with
ratios of about 2. For simple generic function lookups (one specialized
argument, calling a primary method) we got ratios of about 3.

Note that these numbers are from the best port of PCL we did, some other
ports do not perform as well.  Even so, these numbers, given that they
come from PCL, make it clear that it is possible to do at least this
well in CLOS.  More importantly, the use of newer implementation
techniques such as those found in Self, should make it possible to do
much better.  Another important caveat is that these numbers are for a
"development-style" implementation of CLOS.  In a "development-style"
implementation it should be possible to get ratios of 1 pretty easily.