[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Structures vs instances

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?