[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Structures vs instances
- To: info-mcl
- Subject: Structures vs instances
- From: firstname.lastname@example.org (Erann Gat)
- Date: 21 Jul 91 19:22:12 GMT
- Newsgroups: comp.lang.lisp.mcl
- Organization: Jet Propulsion Laboratory
- Sender: email@example.com (Usenet)
- Summary: Why is method dispatch on structure types so slow?
Apologies if this is a repeat - mailer problems.
A question about CLOS and MCL: It seems that there are two different
ways to do object-oriented programming in CLOS if one does not need to
use inheritance. The first is the usual way (i.e. defining classes and
instances) and the second is to define methods which discriminate over
structure types. The advantage of the second method is that the slot
accessors are not generic functions and therefore run much faster.
However, in MCL method dispatch over structure types is VERY slow, up
to twenty times slower than a straight function call by my benchmarks.
Even dispatching over individual floats runs about twice as fast as
dispatching over structure types. Why is this? Is there a way around it?