[3.9] Invisible method, missing changeset, backporting?
Adrian Lienhard
adi at netstyle.ch
Mon Mar 20 15:25:12 UTC 2006
Hi Bert,
indeed, there is something strange going on when loading the two
packages (Traits-al.214 and Kernel-al.109). Thanks for pointing that
out.
On Mar 20, 2006, at 12:05 , Bert Freudenberg wrote:
[...]
> What would be needed to backport this speed-up to 3.8(.1)? How did
> this change get into the system? Why wasn't it recorded in a
> changeset?
The change is quite simple, for pre 3.9, the attached changeset
should work (note, #category: duplicates the implementation in
ClassDescription, hence should probably be removed there).
The actual trick is to implement #category as follows in Class:
category
category ifNotNil: [
((SystemOrganization listAtCategoryNamed: category) includes: self
name)
ifTrue: [ ^category ] ].
category := super category.
^category
It uses the ivar as a cache to make a guess (which is quite fast) and
only falls back to the old, slow behavior of looking through the
whole system category list if this fails.
The change in 3.9 does the same but also for the class Trait. To do
this, there is a trait that is shared between Class and Trait. Latter
additionally has a new ivar (Class had this already defined, but was
not used, why?).
HTH,
Adrian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: categoryspeedup.cs
Type: application/octet-stream
Size: 1038 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20060320/aabfdfbc/categoryspeedup.obj
More information about the Squeak-dev
mailing list
|