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

Re: Type-checking of slot values

>      If CLOS is defined is such a way that acceptable performance is only
>      achievable on "special purpose" hardware [e.g., a defclass is far too
>      slow to be a substitute for defstruct], then I suspect it will be subject
>      to Deutsch's Dictum:

> I don't think that the type checking has anything to do with good
> performance. The important thing for good performance is that  an
> implementation an optimize slot access based on :type information. I
> don't want to take that away from CLOS, or CLtL.

Sorry, but I think you're wrong. On stock hardware, FIXNUM + is one
instruction, and a compiler which can deduce when to use it will always
win over one that can't. Similiarly, with CLOS, a compiler which
can substitute two memory references for a call to SLOT-VALUE will
win, modulo concerns about SAFETY. Type checking is important for
performance on stock hardware, unfortunately, Common Lisp is defined
such that type checking is completely optional, guaranteeing divergence
between what different vendors supply. Whether or not that should be
fixed is a different story, and, as has been pointed out, this is
not the place to discuss it.