Array new: 1000000 performance question

Stephan Rudlof sr at evolgo.de
Wed Jul 21 01:07:13 UTC 2004


John M McIntosh wrote:
> ...

> You'll note if you allocate a new object then drop it into the Array  
> then it will cause the million array object to become a root object  
> since
> it points to an element in newspace. This causes us to iterate over the  
> million elements again and CPU time will go way up.
> 
> Solving this issue is an exercise for the reader.

What about (arr pointing to objects in newspace)
  Smalltalk garbageCollect.
  arr := arr collect: [:e | e]
?

>...
-- 
Stephan Rudlof (sr at evolgo.de)
   "Genius doesn't work on an assembly line basis.
    You can't simply say, 'Today I will be brilliant.'"
    -- Kirk, "The Ultimate Computer", stardate 4731.3



More information about the Squeak-dev mailing list