Only process a certain number of indexes per ENTER_FRAME event.  I usually set 
a getTimer() at the start of my processing function, and loop until the 
difference is greater than my threshold:

Function onEnterFrame(event:Event):void
{
     var startTime:int = getTimer();
     while( getTimer() - startTime < THRESHOLD && !done)
     {
          /* Process data */
     }

     If (done)
     {
          this.removeEventListener(Event.ENTER_FRAME, onEnterFrame, false); // 
Stop processing data
          this.dispatchEvent(new Event(Event.COMPLETE, false, false)); // Tell 
listeners that we're done
     }
}

Jonathon


From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf 
Of Ryan Graham
Sent: Friday, February 27, 2009 2:22 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Breaking up large array processing

Hi All,

I currently have 2 separate collections that I need to sync up based on ids. 
One has 25000 elements and the other has 4000. A typical nested for loop 
structure gives me the 1502 script time limit exception after 60 seconds. I've 
tried all the performance optimizations on Alex's blog, but it's still taking 
too long. Does anyone have a sample or tips on how to break up this type of 
processing? Maybe do 4 passes, each processing 1000 of my 4000 input elements?  
Any help is much appreciated!

Thanks,
Ryan
This message is private and confidential. If you have received it in error, 
please notify the sender and remove it from your system.


<<inline: image001.jpg>>

<<inline: image002.jpg>>

Reply via email to