[SPAM] Re: [Newbies] Computational complexity of become: and becomeForward:

Mateusz Grotek unoduetre at poczta.onet.pl
Thu Sep 27 16:20:47 UTC 2012

Levente Uzonyi pisze:
> I forgot to mention that in Smalltalks which have an object table, the
> cost of these methods is O(1). Igor had a proposal to add support for
> O(1) cost versions of these methods by using relay objects, but it
> doesn't work well with compact classes and it would use up the last free
> bit in the object header. I think the conclusion was that only the new
> object format will support it.
> In some edge cases [1] you can use #copyFrom: instead of
> #becomeForward:. The former has O(1) runtime cost.
> Levente
> [1] The argument must have the same class and the same number of slots
> as the receiver. If there are objects which point to the argument
> already, then those will keep pointing the same object - which will be
> different than the receiver, so changes done to the argument after
> #copyFrom: won't affect the receiver and vica versa.

Thank you very much for a very comprehensive answer!

More information about the Beginners mailing list