Tracy,

Before I started parsing the file it actually worked simply iterating
over the files and adding them to the DB without processing them.
After I started parsing the files I started getting this halting of
the UI.

Do you have any more details about how your technique was different?
Maybe a quick excerpt of code could help clarify your technique.

Thanks,
Charlie


On Tue, Dec 23, 2008 at 10:26 AM, Tracy Spratt <[email protected]> wrote:
> I have used this technique to break up long running processes.
>
>
>
> But I use two functions and two instance variables so that the function of
> the iterator is entirely separate from the processor.
>
>
>
> The way you are doing it , essentially recursively, may be causing the
> problem.
>
>
>
> Tracy
>
>
>
> ________________________________
>
> From: [email protected] [mailto:[email protected]] On
> Behalf Of Charlie Hubbard
> Sent: Tuesday, December 23, 2008 8:35 AM
> To: [email protected]
> Subject: [flexcoders] Performance and UI failing to update?
>
>
>
> I'm writing an AIR application where I have a very long operation that
> I need to run in the background. I know Actionscript doesn't have
> threads so I'm trying to simulate that using cooperative multi-tasking
> by breaking up my job into smaller pieces. I'm basically trying to
> parse an XML file, iterating over the nodes in that XML document,
> parsing the file that node refers to, add an entry to the SQL lite DB.
> The parsing of the XML is done separately from the iteration, and
> each iteration of the loop over the nodes is done using
> UIComponent.callLater(). So my algorithm looks pretty close to
> something of this form:
>
> function doIteration( currentIndex : int, totalIndex: int ) : void {
> var current : Object = objects[ currentIndex ];
> doSomething( current );
> callLater( doIteration, [ currentIndex + 1, totalIndex ] );
> }
>
> My expectation is that by using callLater that will allow my UI to
> paint and update between each iteration of my loop. However, that
> doesn't seem to be the case. When my application starts this process
> it updates very infrequently, and freezes most of the time. I can put
> trace statements in my loop and see that it's processing loads of
> files very quickly, but the UI never gets updated.
>
> How does Flash behave when it's under a load like this? It runs as 12
> frames/s, and I know that callLater is done at the end of each frame.
> What happens if that process run is longer than 80ms/frame (1000ms/s
> divided by 12 frames / s)? Does it ever catch up?
>
> Thanks
> Charlie
>
> 

Reply via email to