-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 2/17/11 5:22 PM, Gabriel Zachmann wrote: >> You will want to decouple the image load and decode operation from the >> render side of things as much as you can. > > The point is that on the "render side" there is actually very little work to > be done. > All I do in my code is to set up a new Core Animation layer every 10 seconds. > So, will moving the image loading (which is the only CPU intensive operation > during the setup of the new layer) to another thread really help? > >> You can do that with >> threading, async loading, and/or operations/blocks. > > Which API would you recommend for async loading?
I'd probably being by answering the question, "which platforms and OS versions do I need to support?" Blocks are pretty new, especially to iOS. I think that for many (though not all) situations, using blocks (as briefly discussed below) is easiest and tidiest, but comes at the expense of backward compatibility. I gather that, since you are using Core Animation, you are targeting >= 10.5. However, since blocks weren't introduced until 10.6, you still have some decision making to do. I maintain iOS code that uses NSOperation/NSOperationQueue to handle concurrency. It's slightly clunkier, but is widely supported. Note that Mike Ash has reported issues on certain OS versions; if you go this route be aware of: http://www.mikeash.com/pyblog/dont-use-nsoperationqueue.html and http://www.mikeash.com/pyblog/use-nsoperationqueue.html > Exactly what do yo mean by operations/blocks? "Operations" refers to NSOperationQueue and related classes. "Blocks" refers to the suite of GCD-interacting functions that involve Objective-C blocks (http://developer.apple.com/library/ios/#documentation/cocoa/Conceptual/Blocks/Articles/00_Introduction.html), especially the ubiquitous dispatch_asyc(). Probably the best general introduction to these topics is in the 2010 WWDC videos available to iOS/MacOS developer programs. I believe one was called "Introducing Blocks and GCD on iPhone" - the principles explicated therein are largely platform independent. Core documentation on threading is in the Threading Programming Guide: http://developer.apple.com/library/mac/#documentation/cocoa/conceptual/Multithreading/Introduction/Introduction.html Core documentation on operations and blocks is in the Concurrency Programming Guide: http://developer.apple.com/library/mac/#documentation/General/Conceptual/ConcurrencyProgrammingGuide/Introduction/Introduction.html#//apple_ref/doc/uid/TP40008091 Frankly, I probably wouldn't start with these, though, if you are totally new to concurrent programming. Start with the WWDC videos, provided you have access. - -- Conrad Shultz Synthetiq Solutions www.synthetiqsolutions.com -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7 (Darwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iD8DBQFNXc4AaOlrz5+0JdURAh7kAKCBttXSZ327vW6AyrRw2XUSB61yYwCffqBC kZgIrAr8dHFxI2/y5Fexif8= =Scna -----END PGP SIGNATURE----- _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com