3.7 CLOS optimizations

3.7.3 Optimization of MAKE-INSTANCE

Calls to make-instance will usually be partially optimized at compile time, provided that the class argument is a compile-time constant (and is not of a metaclass known to be outside the scope ofstandard-class), and that the keyword parameter names (if any) are also compile-time constants. For example:

(make-instance 'turtle :legs 4 :color (figure-it-out))
is optimizable, whereas:

(make-instance 'turtle x 4 y (figure-it-out))
is not. There is also a run-time component for assembling the optimization, which is generally invoked upon the first call for that kind of "make-instance." For finer-grained control over this run-time component, see the documentation for the following functions:


Any user-defined methods onmake-instance will defeat the previously -mentioned optimizations, and any user-defined primary or:around methods defined oninitialize-instance orshared-initialize will cause the optimization to run a bit slower.

At all times, under any run-time changes to the class hierarchy or to the set of applicable initialization methods, the compiled code remains correct; at most, the run-time monitor will block the optimization when it is not appropriate.

The Advanced User's Guide - 9 SEP 1996

Generated with Harlequin WebMaker