Metaclass allInstances

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Metaclass allInstances

Nicolas Cellier
I just performed some clean-up in pharo (
http://code.google.com/p/pharo/issues/detail?id=1444 ) and noticed
allInstancesDo: was implemented in Metaclass.

Obviously, this is an optimization for super, because super does work.
But I wonder if this optimization has any use at all

Generally, we should expect #allInstances and #allInstancesDo: to be
slow (iterate the whole image) and restrain from using it.
So, a sparse optimization for one case sounds strange to me... (there
is no optimization for other well known cases like True and False for
example).

Any hint on the existence of this specific optimization ?

PS: John McIntosh already noticed that #allInstances usage was a pain
for iphone, especially at image startup, one more reason to avoid it.

Reply | Threaded
Open this post in threaded view
|

Re: Metaclass allInstances

Andreas.Raab
Nicolas Cellier wrote:
> Any hint on the existence of this specific optimization ?

I'm not certain but at a guess I'd say it may impact reshaping of large
class hierarchies. Try adding an ivar to Morph and see how long that
takes with and without the optimization.

Cheers,
   - Andreas


Reply | Threaded
Open this post in threaded view
|

Re: Re: Metaclass allInstances

Nicolas Cellier
2009/11/14 Andreas Raab <[hidden email]>:

> Nicolas Cellier wrote:
>>
>> Any hint on the existence of this specific optimization ?
>
> I'm not certain but at a guess I'd say it may impact reshaping of large
> class hierarchies. Try adding an ivar to Morph and see how long that takes
> with and without the optimization.
>
> Cheers,
>  - Andreas
>

Oh, I guess the tally will be dominated by compile time... but I will just try.