[squeak-dev] The Trunk: Kernel-cmm.1049.mcz
asqueaker at gmail.com
Fri Nov 18 22:28:22 UTC 2016
> Do you mean you subclassed an object but want it to be written as instance
> of its superclass? And you implemented xxxClass to return the superclass?
>> =============== Diff against Kernel-nice.1048 ===============
>> | cntInstVars cntIndexedVars |
>> cntInstVars := self class instSize.
>> cntIndexedVars := self basicSize.
>> + beginInstance: self xxxClass
>> - beginInstance: self class
>> size: cntInstVars + cntIndexedVars.
> I find the choice of xxxClass pretty odd.
I don't care for the "xxx" nomenclature, I really wanted to use
#actualClass because its perfectly descriptive and something we
already have elsewhere. Except not on Object. At Object we have
Ted's #xxxClass from 1998 with two users.
I decided to use existing method rather than risk waking up sleeping
giant by introucing a new method into Object right now. Right now I'm
only interested in addressing the performance issues of
> But maybe I can understand better
> if you could give an example how you use it.
It is to support a performance fix for source.squeak.org. One of the
bottlenecks I noticed while debugging the timeouts was the Magma
commit taking way too long. If we were using ONLY a Magma backend,
then each repository save (Magma commit) should take only one or two
seconds. However, because we are using both Magma AND the filesystem,
we were forced to read in the entire SSRepository object from Magma
into memory, instead of reading only the parts which are needed for
meeting user access demands.
This means that Magma's changed-detection took over a minute, because
a million objects have to be compared to their state in the DB to see
which ones changed and belong in that CommitPackage.
I want source.squeak.org to continue using FileBased for now, so my
solution to that was to turn on Magma's write-barrier feature. Magma
incorporated Avi Bryant's WriteBarrier back in the mid 2000's so that
the changed-detection can run "as it goes" rather than as a bulk
operation part of the commit, once again speeding up commit saves to
The way it works is when an object is read from the DB, an anonymous
subclass is compiled which overrides all methods which could change an
instVar. It compares the value on either side of the "super" call and
marks the object dirty then. So the class of the object (and others
of its kind read in the future) is changed via #primChangeClassTo:.
But this creates an issue for ReferenceStream to send #class, because
we want to serialize instance of the superclass now. The
anonymous subclass could not override #class to answer the superclass,
so it overrides #xxxClass, and ReferenceStream now sends, #xxxClass.
More information about the Squeak-dev