2008/4/13, Ludovic Courtès <[EMAIL PROTECTED]>: > > I have heard that in a well-done CLOS implementation, accessors are are > > generally faster than slot-ref, because they can perform this class/slot > > allocation calculation once, and have the method implementation just > > dispatch using that table, compiling down to struct-ref instead of > > slot-ref. So working this into accessors and method compilation would be > > one way to do this. > > Yeah. More pragmatically, things like SRFI-9 accessors could be > implemented as applicable SMOBS: > > http://thread.gmane.org/gmane.lisp.guile.devel/6716
I think it's a good idea to read and understand the code before planning changes. At least given the state of Guile at the point when GOOPS accessors were implemented, the current imlementation was superior to both a slot-ref-based and a SMOB-based implementation. This is because dispatching a smob took longer time for the evaluator than interpreting the current special form-based solution (@assert-bound-ref). Note that the current implementation *does* compile in the slot position into this form and indeed *has* the property which Andy mentions above. Also, SMOB-based accessors would be more heavyweight with regard to class creation and memory consumption than the current solution. In any case, *please* always benchmark changes like this against previous code.