Re: How to optimize image loading during core animation?
Re: How to optimize image loading during core animation?
- Subject: Re: How to optimize image loading during core animation?
- From: Laurent Daudelin <email@hidden>
- Date: Thu, 17 Feb 2011 12:58:55 -0800
On Feb 17, 2011, at 09:15, Gabriel Zachmann wrote:
> Thanks a lot for your response, Tomas!
>
>> since no one replied so far, I’d take a try. I’m not much familiar with desktop Cocoa, but on iOS we have to be careful to keep longer actions from the main thread, since delays in the main thread block the UI. Isn’t this about the same issue?
>
> Good question. One problem is that I have not understood a fundamental property of Core Animation.
> I have always assumed that the animation, once I have set it up, is done by the OS / Core Animation in the background, i.e., in a separate thread.
> Is that correct?
> If yes, then wouldn't that mean that moving my image loading into a separate thread would *not* help at all?
> If no, then exactly when / where is the animation performed?
>
> You see, my understanding of the interplay between Core Animation and my application is still a mess ;-}
> So any light anybody can shed on it will be highly appreciated.
>
>> Image loading would be the first thing I would move into a background thread. Can you use GCD? It’s a perfect fit for such producer/consumer tasks.
>
> Please explain "GCD".
GCD is Grand Central Dispatch, the "brain" that the OS uses to execute all running processes. You might want to read on that subject in the developer documentation. You use NSOperationQueue to basically run a thread that will be scheduled and processed by GCD, as opposed to "detachNewThreadSelector:toTarget:withObject:" (and other varieties on the same theme) which just forks a new executing thread for your app. There are some advantages to use GCD as opposed to detach a new thread in your app and you will learn them by reading the doc on the subject.
-Laurent.
--
Laurent Daudelin
AIM/iChat/Skype:LaurentDaudelin http://www.nemesys-soft.com/
Logiciels Nemesys Software email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden