If I modify the default behavior of CLOS using the MOP, what will the
optimizer do? For example, if I decide to change method dispatch to be
symmetric (like Dylan), will the optimizer simply turn off the bulk of
its CLOS specific optimizations? I assume it does. Trying to optimize
when the semantics have changed from under you seems awfully hard.
Thanks,
Pinku
Pinku Surana wrote:
> If I modify the default behavior of CLOS using the MOP, what will the
> optimizer do? For example, if I decide to change method dispatch to be
> symmetric (like Dylan), will the optimizer simply turn off the bulk of
> its CLOS specific optimizations?
That is what I found with AllegroCL, and that is part of why Cells got
de-MOP-timized.
kt
--
Cells? Cello? Cells-Gtk?: http://www.common-lisp.net/project/cells/
Why Lisp? http://lisp.tech.coop/RtL%20Highlight%20Film
"Doctor, I wrestled with reality for forty years, and I am happy to
state that I finally won out over it." -- Elwood P. Dowd
Pinku Surana wrote:
> If I modify the default behavior of CLOS using the MOP, what will the
> optimizer do? For example, if I decide to change method dispatch to be
> symmetric (like Dylan), will the optimizer simply turn off the bulk of
> its CLOS specific optimizations? I assume it does. Trying to optimize
> when the semantics have changed from under you seems awfully hard.
Yes, your own metaobject classes will be slower than the standard ones.
It may be that a CLOS implementation is clever enough to see that major
parts of the method dispatch are not changed and therefore keeps its
optimizations. So for example, if you don't change
compute-discriminating-function and the functions that are called by the
discriminating function, maybe things will stay as efficient as in
"pure" CLOS. So maybe you can add checks to add-method to get symmetric
dispatch.
Pascal
--
2nd European Lisp and Scheme Workshop
July 26 - Glasgow, Scotland - co-located with ECOOP 2005
http://lisp-ecoop05.bknr.net/
Pascal Costanza wrote:
> Pinku Surana wrote:
>> If I modify the default behavior of CLOS using the MOP, what will the
>> optimizer do?
>
> Yes, your own metaobject classes will be slower than the standard ones.
This isn't univerally true. Some specialized metaclasses will impact
optimization, others will not. For example, slot-value can be hugely
optimized provided no specialized methods have been written on
slot-value-using-class. (Ditto for setf thereof.) The ACL MOP
implementation dynamically tracks whether any methods have been
written for s-v-u-c on a particuilar class, defering to the lengthy
documented protocol only if there is a chance that it matters.
Surely others do the same.
"Elegance is not without its price."