[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Accessor performance



There is a major performance decrease in Rainy Day pcl for the standard
slot accessor methods when a standard method with the same name exists for
another class.

e.g.

(defclass a () ((param1 :accessor param1 :initform 'param1-default)))
(defclass b () ())

(defmethod param1 ((self b))
  'b-param1-value)

I couldn't figure out the reason for it, but it seems pcl resorts to
calling slot-value-using-class (rather than the standard-reader-method?)
in these kinds of cases.  This slows slot access down by a factor of 5.

On the other hand, the time to call a standard accessor method on an object
seems to be (basically) unaffected by whether other objects have the
same slot accessor name defined, and the time to call standard methods seems
(basically) unaffected by the number of same-named standard methods and
accessor methods.  It therefore doesn't seem that the slowed standard
slot access is caused by added overhead on calculating method combination.

Is there some way that pcl could be changed to use the normal
standard-reader/writer-methods at all times, rather than using
slot-value-using-class when standard methods exists?

- Trent Lange