[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: dynamic-extent & objects
- To: derek@cambridge.apple.com
- Subject: Re: dynamic-extent & objects
- From: bill@cambridge.apple.com (Bill St. Clair)
- Date: Fri, 13 Mar 1992 10:25:57 -0500
- Cc: info-mcl
>Does the (declare (dynamic-extent x)) change anything?
>
>(let ((x (make-instance 'mac-buffer-stream :data-buffer-size 0)))
> (declare (dynamic-extent x))
> ...
> )
As David Moon said, No.
MAKE-INSTANCE is one place where MCL's CLOS implementation is slower
than many others. It doesn't try to be smart at all, just calls
MAKE-INSTANCE, which calls ALLOCATE-INSTANCE and INITIALIZE-INSTANCE,
which calls SHARED-INITIALIZE, which grovels over the class'es slot
definitions in order to figure out what to do. This makes 5 generic
function dispatches (2 for MAKE-INSTANCE), a hash table lookup, a
couple of dynamic-extent rest args, a couple of keyword parses, and a
bunch of slot descriptor lookups. Rather expensive when the only method
that is typically specialized is INITIALIZE-INSTANCE (how many of you
have started writing SHARED-INITIALIZE methods?), and the only
initforms are constant.
Making this faster is on my list of things to do for 2.1.
Making the dynamic-extent declaration actually do something
might fall out for almost free (no guarantees).