I am experimenting with a very simple optimization that replaces the discriminating function of slot accessors based on the following criteria:

- The generic function should only contain methods of the type standard-reader/writer-method
- The methods should be specialized on classes whose metaclass is standard-class
- The optimization assumes that under those circumstances the user is not allowed to extend the slot-value-using-class method (according to AMOP) and thus the slot accessor can avoid calling slot-value.
- If all this applies, the discriminating function finds out the slot that has to be read and its location (both are cached in a thread-local hash) and reads/writes to the slot.

The preliminary figures cut down the execution time in FPRINT/PRETTY (gabriel's benchmark) by 50%.

To the MOP experts here, does this all sound reasonable?


P.S.: My idea is also to add compute-discriminating-function generic functions to ECL.

Instituto de Física Fundamental, CSIC
c/ Serrano, 113b, Madrid 28006 (Spain)