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

Re: CLOS Speed

Depending on your programming style, there is another place in PCL
that can be changed to significantly speed up execution of a
programming.  If your program applies TYPEP to PCL objects, then you
should look at redefining DO-DEFTYPE (in defs.lisp) to compile the
DEFTYPE body.  The problem is that DO-DEFTYPE eval's a DEFTYPE special
from to define new type predicates for each class.  These predicates
are stored as lists and are evaluated (at least in Allegro CL).  This
evaluation consumed around 25% of the execution type in Curare.

The change for Allegro CL is below.  I don't know of a portable way to
compile this special form declaration (which is clearly a shortcomming
in CL).

(defun do-deftype (name lambda-list &rest body)
  (let #+Symbolics ((si:inhibit-fdefine-warnings t))
       #-Symbolics ()
    #+Lispm (setq body (copy-list body))
    (eval `(deftype ,name ,lambda-list ,@body))
    #+excl (compile `(:property ,name excl::deftype-expander))))