<br><div><span class="gmail_quote">On 10/30/06, <b class="gmail_sendername">Pascal Costanza</b> <<a href="mailto:pc@p-cos.net">pc@p-cos.net</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div style=""><div>OK, I'll see what I can do... ;)</div></div></blockquote><div><br>cool!<br><br>fyi, i've managed to generate accessors with this overhead on sbcl:<br><br>;; standard<br>Evaluation took:<br>  0.225 seconds of real time
<br>  0.216967 seconds of user run time<br>  0.0 seconds of system run time<br>  0 calls to %EVAL<br>  0 page faults and<br>  45,008 bytes consed.<br><br>;; mine with minimal extra code<br>Evaluation took:<br>  0.642 seconds of real time
<br>  0.618906 seconds of user run time<br>  0.012998 seconds of system run time<br>  [Run times include 0.099 seconds GC run time.]<br>  0 calls to %EVAL<br>  0 page faults and<br>  32,014,176 bytes consed.<br><br>unfortunately i don't know where the  consing comes and probably an extra boundp call should not make it 3 times slower then standard accessors.
<br><br>as far as i can see my code should not be consing, and when going though the svuc, even the less optimized verision (also calling slot-definition-location at runtime) is not consing. so i suspect it must be the way i'm generating the accessors:
<br><br>(defmethod finalize-inheritance :after ((class computed-class))<br>  (loop for direct-slot :in (class-direct-slots class)<br>        for effective-slot = (find-slot class (slot-definition-name direct-slot))<br>        when (typep effective-slot 'computed-effective-slot-definition) do
<br>        (assert (and (<= (length (slot-definition-readers direct-slot)) 1)<br>                     (<= (length (slot-definition-writers direct-slot)) 1))<br>                () "Computed class does not support multiple readers and/or writers.")
<br>        (let ((reader (first (slot-definition-readers direct-slot)))<br>              (writer (first (slot-definition-writers direct-slot))))<br>          #+generate-custom-reader<br>          (when reader<br>            ;; FIXME: this setf is a KLUDGE to stop sbcl from generating it's own reader after (?!) this
<br>            (setf (slot-definition-readers direct-slot) nil)<br>            (let ((reader-gf (ensure-generic-function reader))) <br>              (ensure-method reader-gf<br>                             `(lambda (object)
<br>                               (declare #.(optimize-declaration))<br>                               ,(slot-value-using-class-body effective-slot))<br>                             :specializers (list class))))<br>          #+generate-custom-writer
<br>          (when writer<br>            ;; FIXME: this setf is a KLUDGE to stop sbcl from generating it's own writer after (?!) this<br>            (setf (slot-definition-writers direct-slot) nil)<br>            (ensure-generic-function writer)
<br>            (let ((writer-gf (ensure-generic-function writer))) <br>              (ensure-method writer-gf<br>                             `(lambda (new-value object)<br>                               (declare #.(optimize-declaration))
<br>                               ,(setf-slot-value-using-class-body effective-slot))<br>                             :specializers (list (find-class 't) class)))))))<br><br>it's not really important for now, but maybe someone can spot something. also the kludge is probably only needed because i'm doing this at the wrong point in the MOP.
<br></div></div><br>-- <br>- attila<br><br>"- The truth is that I've been too considerate, and so became unintentionally cruel...<br> - I understand.<br> - No, you don't understand! We don't speak the same language!"
<br>(Ingmar Bergman - Smultronstället)