ADC Article on NSOperation Published
By drewmccormack at Thu, Jun 26 2008 12:59pm |
The Apple Developer Connection (ADC) has just published an article that I wrote on using NSOperation to improve the performance of Cocoa apps on multi-core Macs. It includes source code for two simple applications that use NSOperation to perform simultaneous downloads. The article goes into quite a bit more depth than some of the reviews I have seen, with discussion of dependencies and the NSInvocationOperation class.
Note that I also wrote a tutorial on NSOperation here on MacResearch, which includes source code for an app that performs linear algebra operations in place of downloads.



Comments
Great article
Congrats Drew, nice article! I did notice however the following errors when trying the demo app:
Xcode(3793,0xb0103000) malloc: free_garbage: garbage ptr = 0x313adb0, has non-zero refcount = 1
I had started a search, the progress indicator filled almost completely but in the final 2-3 % is slowed down and then basically stopped. Any clues or seen this before?
GC problem
I'm not sure about the GC problem. The slowdown can be explained: images are downloaded in groups (layers); the layer is not complete until all images are downloaded in the layer. So the progress can slow toward the end of a layer if one or more images take a long time to download. It may be possible to avoid this with a timeout of some sort, but I didn't try.
Drew
---------------------------
Drew McCormack
http://www.maccoremac.com
http://www.macanics.net
http://www.macresearch.org
built with Xcode beta version?
Great job, Drew!
When using xcode 3.0 to open the project, I got again the problem where no archs is set in the build settings, and some problems with the selected SDK (this is a problem I have seen before when a project was set using the beta version of Xcode,, 3.1?). After fixing those issues, it worked fine.