I was trying to debug an issue with the LogBook application we released a
couple of days back. If you take a look at the interface on the main page at
http://cimlogbook.googlecode.com (or if you have installed the application),
you will see a clear logs button. Clicking on that clears an ArrayCollection
that holds a series of LogObjects by calling a removeAll() function. However
we got a bug saying the application would almost hang if it tried to clear a
lot of messages. A quick patch was to reset the source like so:
arrayCollection.source = [] . The performance became lightning fast.

Looking deeper into the removeAll function and following the hierarchy to
the ArrayList class, I see that the removeAll loops through the entire
array, looking at each member to see if its an event dispatcher and if so
calling a function to remove the propertyChange listener.
Why is this implemented this way ? Is there any reason I shouldnt just use
source = [] to reset the array ?

Thanks


-- 
Arpit Mathur
Lead Software Engineer,
Comcast Interactive Media
---------------------------------------
post your flex tips on
http://flextips.corank.com

Reply via email to