-
Notifications
You must be signed in to change notification settings - Fork 80
Only scan the class table if become:
was performed to an active class object
#1023
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: pharo-12
Are you sure you want to change the base?
Conversation
Just out of curiosity what the users of become: in your image. If I remember correctly become: does not scan the complete memory but place forwarders that are removed during the next GC phase. |
The is true, but the thing here is that it also scan the class table, to avoid having forwarders there? I imagine it is a class in the class table?? 🤷♂️ |
We have many different users in our image, but the one that made us aware of this issue involves lazy copying of objects (i.e., creating a dummy and copying the object when looked at, using
This is also what I understand from pharo-vm/smalltalksrc/VMMaker/SpurMemoryManager.class.st Lines 2804 to 2820 in a7c8a0b
|
Hi, this PR looks promising. We should make it against pharo-12 branch so it can be tested in the dev version of the VM |
44a6a98
to
0751815
Compare
We (Lifeware) have some issues in Pharo with the performance of
become:
. This hurts us in some code that performs a very large number of calls tobecome:
. The following code illustrates the issue:In vanilla Pharo it takes about 20 milliseconds on my machine. In a Pharo image with GT + Lifeware code (resulting in ~175000 classes) it takes about 1 second.
We found that the issue is that in the Pharo VM,
become:
scans through the complete class table (nearly) every time. This means the more classes there are in the image, the slower it will be. Note that the method comment inSpurMemoryManager>>#postBecomeScanClassTable:
indicates that this should only happen when an active class object has been becomed.In this pull request I try to make the change to only do the scan in case we actually becomed an active class object by changing the guard slightly. With this it only takes 7 milliseconds in the image with GT + Lifeware code (and 3 milliseconds in vanilla Pharo). While I think that should be correct, because it also aligns with the comment in the method I changed, this should definitely be reviewed by someone with more knowledge about the VM than me.