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

Re: compile-flavor-methods for CLOS

> Date: Mon, 17 Dec 90 17:55 CST
> From: LRAK561@utxvms.cc.utexas.edu
> A few months ago I remember seeing a question on this bboard asking
> if something like compile-flavor-methods exists for CLOS, and I remember
> that the answer was No.  Do I remember correctly?  Is there something I
> can do in CLOS that will have the equivalent effect?
> I have an application which uses CLOS, and start-up time is slowed by
> what appears to be (in the lower right-hand corner) compilation of CLOS
> hierarchies.

One thing you can do is to locate each make-instance form in your program
and collect a similar form (that is, making an instance of the
same class with the same initialization argument keywords in the same order)
into a function that gets called when the program is loaded.  This will
make loading take longer, but will make the program start up faster once
it's loaded, since all the classes will be all ready to be instantiated.
In 8.1 you won't need to do this if the classes in your make-instance forms
are constant.  In 8.0 you don't need to do this if the classes in your
make-instance forms are constant AND you save the world after loading the
program and before running it.

The above technique won't eliminate all the start-up time, but it will eliminate
a lot of it.  For most programs it will eliminate all or almost all the compilation.
There are ways (albeit unportable, undocument, and kludgey) to eliminate more of
the overhead, again by doing at load time work that would otherwise be done at
run time the first time a portion of the program is executed.  I can't explain
them here but if you ask software support how CLIM starts up quickly they can
probably help you.

It's certainly unfortunate that the CLOS designers, myself included, were unable
or unwilling to provide standard, portable facilities to deal with this issue.