On Aug 3, 2011, at 8:45 AM, Pat Maddox wrote:
> On Aug 2, 2011, at 11:40 PM, Sean P. DeNigris wrote:
>
>>
>> Pat Maddox-3 wrote:
>>>
>>> become: swaps the two objects entirely, becomeForward: "replaces"
>>> references with the argument.
>>>
>>
>> Got it, thanks. The system tests (duh) for these are really clear.
>
> it's generally better to use becomeForward: unless you have a really good reason to use become: and it's generally better to use anything other than becomeForward: if you can. It's what dubya would call "the nukular opshin"
>
And you need to take care: #become can be very slow. It can (if not both objects are in the newspace of the GC) require to scan the *whole* memory.
This is slow and performance degrades the more memory you use.
The "fast bulk become" that is sometimes listed as a major innovation of the squeak vm is only related to becomming multiple objects: you can
become a group of objects and traverse the memory only once. But as it does scan the whole memory.
The sad thing is that a fast become would be really nice for many things... e.g. if you want to do highly dynamic stuff with proxies. Making
objects remote, swap them, or have proxies for objects-not-yet there (futures)...
But in practice #become is far too slow for these. We should change that.
Marcus
--
Marcus Denker --
http://marcusdenker.de