[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Slot-boundp vs slot access
- To: Ranson <ranson@LANNION.cnet.fr>
- Subject: Re: Slot-boundp vs slot access
- From: bill@cambridge.apple.com (Bill St. Clair)
- Date: Wed, 8 Jul 1992 10:17:32 -0500
- Cc: info-mcl
>Why is slot-boundp slower than slot accessors (almost twice as slow from my
>tests)? I would have thought that an unbound slot is in fact bound to a special
>value (a cons for instance).
> Daniel.
Slot accessors (as defined by DEFCLASS) are MCL's optimized form of
slot access. All other slot access (including SLOT-BOUNDP) in MCL uses
linear search to find the slot. The implementation is as fast as it can
be (a two-instruction assembly language loop), but it's still linear search.
Slot accessors hash the class wrapper to an index for the slot: a faster
algorithm.
An unbound slot is indeed marked by a special value. This makes SLOT-BOUNDP
run at about the same speed as SLOT-VALUE.