[Openmcl-devel] unstable computing times with transient classes

Boris Smilga agrostistenuis at yandex.ru
Sun Aug 17 02:17:13 PDT 2008


Hello.

I would like to ask a question concerning the inner workings of CCL, which was prompted by the following events.

I was recently experimenting with transient object classes, i.e. classes which are created dynamically and exist only as long as they have instances. (This has some affinity with how prototype-based object systems work.) One evident approach here is to create anonymous classes using (MAKE-INSTANCE 'STANDARD-CLASS) and operate on them using MOP capabilities. What I found out, however, was that this approach has serious performance issues.

To abstract away unnecessary details, I conducted the following experiment:

1. Generate a grove, G, which is a list of conses (KEY . VALUE) where KEYs are symbols and VALUEs are either strings or nested groves. A good size of groves for our purposes would be in the thousands of nodes.

2a. For G (and, recursively, for each of its subgroves), create C: an anonymous STANDARD-CLASS whose DIRECT-SLOTS are named after G's KEYs and which is a subclass of STANDARD-OBJECT.

2b. Do (REMOVE-DIRECT-SUBCLASS (FIND-CLASS 'STANDARD-OBJECT) C), so that DIRECT-SUBCLASSES of STANDARD-OBJECT do not bloat.

2c. Create an instance of C and set its slots to the VALUEs consed on G's respective KEYs.

3. Repeat steps 2a-2c several times (for the same G), measuring the runtime.

The Lisp code for the experiment and the transcript are attached herewith.  To summarize, the runtimes were extremely unstable, rising from 1½ sec. on the 1st iteration to 49 sec. on the 16th, then quickly dropping to 7 sec. and rising again, and so on.  (I have run the test in Darwin console mode to exclude that other software appropriates processing cycles; and it doesn't look like the time was being spent on GC.)

Evidently, there is something in the underlying system that causes the runtimes to veer, and I don't quite understand what that is.  I would truly appreciate if someone who knows the implementation satisfied my curiosity about what is going on here.  (Whether it can be fixed on the user side is also of no little interest.)

Sincerely,
 - B. Smilga.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: test-transient-classes.lisp
Type: application/octet-stream
Size: 2572 bytes
Desc: not available
URL: <https://lists.clozure.com/pipermail/openmcl-devel/attachments/20080817/980ce544/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test-transient-classes.out
Type: application/octet-stream
Size: 16271 bytes
Desc: not available
URL: <https://lists.clozure.com/pipermail/openmcl-devel/attachments/20080817/980ce544/attachment-0001.obj>


More information about the Openmcl-devel mailing list