🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: cu.slug
Article #403

CLOS accessors in genera 8.3

#403
From: Tim Bradshaw
Date: Thu, 12 Mar 1998 00:00
50 lines
2343 bytes
Perhaps this would be more appropriate on comp.lang.clos but it seems
not to happen other than on  Genera, so I'll try here first.

I'm using 8.3 on a 3650 (at home!), and I found the following slightly
unfortunate performance issue:

If I define a class with accessors for its slots:

	(defclass fibly ()
	   ((s1 :accessor fibly-s1)))

Then calling FIBLY-S1 inside a method is extremely (well, byt the
standards of the machine) fast -- pretty much as good as using the
slot directly.

*But* If I define some auxilliary method on FIBLY-S1:

	(defmethod fibly-s1 :after ((f fibly))
	  ... check something about the slot or something, or even
	  empty ...)

Then performance is catastrophically worse (something like a 20-30x
hit).  If I defined the accessor manually:

	(defclass fibly ()
	   ((s1)))
	(defmethod fibly-s1 ((f fibly))
	   (slot-value f 's1))
	
then the difference in performance between the single-method case &
the  primary-method + aux-method is a factor of 2 or something (and
the second case is much faster than the automatically-defined reader +
aux method case).

This is a real pain because it makes defining methods to check
consistency & stuff on accessors painful.  Of course I'm not expecting
amazing performance from the machine, but this kind of slowdown makes
it hard to even test stuff I'm writing to take in to work later.  I'm
quite willing to sacrifice the very fast best case for a less bad
slowdown if I can avoid having to define all my own methods for
accessors.

Does anyone know if there's anything that can be done about this, sort
of shadowing DEFCLASS and making it do something different with
accessors.

Thanks

--tim
Technical Details
Message-ID: <889702700.17898@news.Colorado.EDU>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10077e,9c04e8b25ec363a0,start
X-Google-Attributes: gid10077e,public
From: Tim Bradshaw <tfb@aiai.ed.ac.uk>
Subject: CLOS accessors in genera 8.3
Date: 1998/03/12
Message-ID: <889702700.17898@news.Colorado.EDU>
X-Deja-AN: 333300436
Distribution: cu
Content-Transfer-Encoding: 7bit
Sender: daemon@lace.colorado.edu
Content-Type: text/plain; charset=us-ascii
X-Note1: message-id generated by recnews
X-Note2: mail msgid was   <199803121118.LAA10368@todday.aiai.ed.ac.uk>
Organization: University of Colorado at Boulder
Mime-Version: 1.0
Newsgroups: cu.slug