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

Re: Compilation of methods per class.



I installed Doug Cutting's call-next-method patch, but I unfortunately
couldn't detect any significant speedup, at least in Lucid 3.0.1 on
the Sun-4 or even Allegro 3.1.13.1 on the Sun-4.  (Changing the conses
in the body of my test methods to fixnum arithmetic made no difference
in the timings either.)

I've been using May Day (rev 2) in all cases.  Most of the hypotheses
so far involve the caching scheme in Victoria Day and older versions of PCL.
Are there any ideas why these generic function call slowdowns might occur
in May Day?

I don't know if this helps any, but further experimentation revealed
that the time to process a generic function call is dramatically effected
by an interaction between the order in which the first generic
function call on each class occurs and the order in which the first
make-instance on the class occurs.  This is true for even the simplest
example, e.g. with classes and methods:

(defclass everybody-inherit-class () ())
(defclass class1  (everybody-inherit-class) ())
(defclass class2  (everybody-inherit-class) ())

(defmethod really-fast-foo ((self everybody-inherit-class)) 10)
(defmethod slow-foo        ((self class1)) 31)
(defmethod slow-foo        ((self class2)) 32)

If the first usages are:

(defvar i1 (make-instance 'class1))
(defvar i2 (make-instance 'class2))
(slow-foo i1)
(slow-foo i2)

Then the following run times results (Lucid on Sun-4):

> (time-test (really-fast-foo i1) (slow-foo i1) (slow-foo i2)))
                  0.01181           0.01394        0.01392

If, on the other hand, the two make-instances are swapped OR the first calls
to slow-foo are swapped, then the times are 0.01181, 0.01810, and 0.01652
(respectively).  If both are swapped, then the times go back to the
original.

These difference in run times themselves aren't huge (between 17 and 53%
over the generic specialized only once, but perhaps they are a clue
as to what is going on the larger case.  When I made these kinds of changes
for the test file I sent out last time (with 5 primary and 4 :around
specializations of slow-foo), the run time differences were more
dramatic, making times range from nearly as fast as the generic
functions with single specializations to 3 times slower by only varying
order of initial generic function calls.

Hopefully this will mean something to somebody, though maybe not.

- Trent Lange