2009/10/12 Erik Huelsmann ehuels@gmail.com:
Profiling one of the performance tests for CL-BENCH which shows huge difference with CLISP, it turned out that our CHECK-INITARGS function in the MOP package is taking 40% of the object instantiation time consumed by MAKE-INSTANCE. After the first invocation, it's possible to replace this function by a lookup in a cache.
I'm not all that surprised that check-initargs shows up with such a high percentage. That's what Peter Graves warned about, being the reason why the checking has been disabled thus far. I've been aware of the need for a cache of some kind, but I'd prefer getting the generic keyword argument checking to a working state before doing optimizations (well, we can call them performance improvements if that sounds nicer :)). We check them pretty well for the methods invoked by make-instance, but that's about it. We also have some other method invocation failures in the ansi-tests.
I am interested in hearing ideas as to how the cache would be keyed and what exactly would it contain. I haven't done much design work to tackle this issue yet, all I have at the moment is a vague idea of using a mapping from _something_ to the set of names of the keyword args in the EMF. It doesn't seem to be a single-level 1-to-many mapping, because there may be multiple discriminating types that are used for choosing a method, and the generic-function name itself is not sufficient either.
Maybe I'm just missing something simple. EMFs are compiled, so perhaps the compilation can create the cache/mapping?