I have downloaded Tiny CLOS from
http://www2.parc.com/csl/groups/sda/projects/oi/software.html
The readme says the following, among other things:
"Even though the Tiny CLOS implementation itself isn't optimized, this
MOP is amenable to optimization, using techniques like those mentioned
in AMOP. In fact, the slot access protocol used in this MOP is such
that it should be possible to get better performance than is possible
with the CLOS MOP."
Does anyone what this means in detail? I haven't yet read the AMOP book,
so it's hard for me to figure out what the differences are...
Thanks in advance for any hints.
Pascal
--
Tyler: "How's that working out for you?"
Jack: "Great."
Tyler: "Keep it up, then."
Pascal Costanza wrote:
>
> I have downloaded Tiny CLOS from
> http://www2.parc.com/csl/groups/sda/projects/oi/software.html
>
> The readme says the following, among other things:
>
> "Even though the Tiny CLOS implementation itself isn't optimized, this
> MOP is amenable to optimization, using techniques like those mentioned
> in AMOP. In fact, the slot access protocol used in this MOP is such
> that it should be possible to get better performance than is possible
> with the CLOS MOP."
>
> Does anyone what this means in detail?
No, but that has never stopped me before. :) Looking at Tiny-CLOS.scm, I
see:
;
; These are the real versions of slot-ref and slot-set!. Because of the
; way the new slot access protocol works, with no generic call in line,
; they can be defined up front like this. Cool eh?
;
;
(define slot-ref
(lambda (object slot-name)
(let* ((info (lookup-slot-info (class-of object) slot-name))
(getter (list-ref info 0)))
(getter object))))
(define slot-set!
(lambda (object slot-name new-value)
(let* ((info (lookup-slot-info (class-of object) slot-name))
(setter (list-ref info 1)))
(setter object new-value))))
A full-blown CLOS MOP goes (from memory):
(defun slot-value (it slot &aux (c (class-of it)))
(slot-value-using-class ;; generic method
c it (find slot (class-slots c)
:key 'slot-definition-name)))
I see Gregor above crowing over the absence of generic dispatch, so
maybe that is where the greater speed potential lies. Mind you, slot
access is just one part of OO overhead, but I wager as you look at other
aspects (sorry) you'll find similarly less amount of generic
dispatch/flexibility.
reading other stuff at that link, I see Gregor saying things like: "The
MOP in Tiny CLOS...retains much of the power of both of the
MOPs found in AMOP." and that t/c has "essentially all the power" of AMOP.
So it looks like they trimmed a lot of fat (MOP-extending generic
dispatch) in AMOP, losing what they deemed as flexibility overkill.
kenny
--
http://tilton-technology.com
Why Lisp? http://alu.cliki.net/RtL%20Highlight%20Film
Your Project Here! http://alu.cliki.net/Industry%20Application
Kenny Tilton wrote:
>
>
> Pascal Costanza wrote:
>
>>
>> I have downloaded Tiny CLOS from
>> http://www2.parc.com/csl/groups/sda/projects/oi/software.html
>>
>> The readme says the following, among other things:
>>
>> "Even though the Tiny CLOS implementation itself isn't optimized, this
>> MOP is amenable to optimization, using techniques like those mentioned
>> in AMOP. In fact, the slot access protocol used in this MOP is such
>> that it should be possible to get better performance than is possible
>> with the CLOS MOP."
>>
>> Does anyone what this means in detail?
>
>
> No, but that has never stopped me before. :) Looking at Tiny-CLOS.scm, I
> see:
>
> ;
> ; These are the real versions of slot-ref and slot-set!. Because of the
> ; way the new slot access protocol works, with no generic call in line,
> ; they can be defined up front like this. Cool eh?
> ;
> ;
> (define slot-ref
> (lambda (object slot-name)
> (let* ((info (lookup-slot-info (class-of object) slot-name))
> (getter (list-ref info 0)))
> (getter object))))
>
> (define slot-set!
> (lambda (object slot-name new-value)
> (let* ((info (lookup-slot-info (class-of object) slot-name))
> (setter (list-ref info 1)))
> (setter object new-value))))
Sorry, there was no reason to include the setter since I only showed a
possible getter on the CLOS side. That said, the t/c and clos setters
differ in exactly the same way as the getters.
kenny
--
http://tilton-technology.com
Why Lisp? http://alu.cliki.net/RtL%20Highlight%20Film
Your Project Here! http://alu.cliki.net/Industry%20Application
Kenny Tilton wrote:
>
>
> Pascal Costanza wrote:
>
>>
>> I have downloaded Tiny CLOS from
>> http://www2.parc.com/csl/groups/sda/projects/oi/software.html
>>
>> The readme says the following, among other things:
>>
>> "Even though the Tiny CLOS implementation itself isn't optimized, this
>> MOP is amenable to optimization, using techniques like those mentioned
>> in AMOP. In fact, the slot access protocol used in this MOP is such
>> that it should be possible to get better performance than is possible
>> with the CLOS MOP."
>>
>> Does anyone what this means in detail?
>
>
> No, but that has never stopped me before. :) Looking at Tiny-CLOS.scm, I
> see:
>
> ;
> ; These are the real versions of slot-ref and slot-set!. Because of the
> ; way the new slot access protocol works, with no generic call in line,
> ; they can be defined up front like this. Cool eh?
> ;
> ;
> (define slot-ref
> (lambda (object slot-name)
> (let* ((info (lookup-slot-info (class-of object) slot-name))
> (getter (list-ref info 0)))
> (getter object))))
>
> (define slot-set!
> (lambda (object slot-name new-value)
> (let* ((info (lookup-slot-info (class-of object) slot-name))
> (setter (list-ref info 1)))
> (setter object new-value))))
>
> A full-blown CLOS MOP goes (from memory):
>
> (defun slot-value (it slot &aux (c (class-of it)))
> (slot-value-using-class ;; generic method
> c it (find slot (class-slots c)
> :key 'slot-definition-name)))
Hmm, I haven't seen the forest from the trees. :}
Thanks a lot for this hint - this is exactly what I was looking for.
> I see Gregor above crowing over the absence of generic dispatch, so
> maybe that is where the greater speed potential lies. Mind you, slot
> access is just one part of OO overhead, but I wager as you look at other
> aspects (sorry) you'll find similarly less amount of generic
> dispatch/flexibility.
>
> reading other stuff at that link, I see Gregor saying things like: "The
> MOP in Tiny CLOS...retains much of the power of both of the
> MOPs found in AMOP." and that t/c has "essentially all the power" of AMOP.
>
> So it looks like they trimmed a lot of fat (MOP-extending generic
> dispatch) in AMOP, losing what they deemed as flexibility overkill.
Yes, but it's also worthwhile to note that he says in other places that
they did so mainly for educational purposes.
Thanks again,
Pascal
--
Tyler: "How's that working out for you?"
Jack: "Great."
Tyler: "Keep it up, then."
"Pascal Costanza" <········@web.de> wrote
>
...
> Does anyone what this means in detail? I haven't yet read the AMOP book,
What!!!
;-)
More seriously you should really read it.
Marc
Marc Battyani wrote:
> "Pascal Costanza" <········@web.de> wrote
>
> ...
>
>>Does anyone what this means in detail? I haven't yet read the AMOP book,
>
>
> What!!!
> ;-)
>
> More seriously you should really read it.
Yes, I know. Shame on me. ;)
Pascal
--
Tyler: "How's that working out for you?"
Jack: "Great."
Tyler: "Keep it up, then."