[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
An application I am involved with has a simple process wait function:
It iterates over the elements of an array, and if the element is of the
appropriate type (a session), that element is sent a :poll message.
Because the elements of the array can be nil, a keyword, or an object;
the iteration is driven off the results of (typep ....)
While we were timing various portions of the System, we discovered
thousands of conses of (INSTANCE SESSION) formed every second!
We traced these conses to the call to typep!
For instance, try the following:
(defflavor ship () ())
(setf s (make-instance 'ship))
(time (progn (typep s 'ship) (typep s 'ship)) t)
Evaluation of (PROGN (TYPEP S #) (TYPEP S #)) took 0.001267 seconds of elapsed time
including 0.000 seconds waiting for the disk for 0 faults.
4 list words consed in WORKING-STORAGE-AREA.
Consed in list region of WORKING-STORAGE-AREA:
These conses are actually created by a call to cli::type-expand.
Now I imagine these conses will be caught by the ephemeral garbage
collector, but I wonder if they are required at all!
I am not looking for stop gap solutions; there are several ways of
eliminating the call in this case. I would like to see typep itself
fixed or at the very least documented in this inefficiency.