-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 6/20/11 8:43 PM, James Merkel wrote:
> First of all (kind of basic) what is GCD ? Sorry, I shouldn't just throw acronyms around. GCD stands for "Grand Central Dispatch" - Apple's newest technology for concurrent programming. It has a relatively high-level API that wraps the whole threading interface so you don't have to think about it. Details are available at http://developer.apple.com/library/mac/#documentation/Performance/Reference/GCD_libdispatch_Ref/Reference/reference.html but you probably want to start with the Concurrency Programming Guide (http://developer.apple.com/library/mac/#documentation/General/Conceptual/ConcurrencyProgrammingGuide/Introduction/Introduction.html) for a gentler introduction. > I have actually implemented this a couple of different ways (not using > threads). > At first I just had lazy loading of the TableView. Whenever the > TableView needed something a file was accessed and a thumbnail > extracted. Then I changed it to do preprocessing. That is, everything > was extracted from the files and then the TableView was allowed to > load. The first approach uses less memory but is slower in updating the > TableView (when it is scrolled for example). The second approach uses > more memory but is faster in updating (provides a better user > experience). I think trying to do this in a separate thread would be > much cleaner using the second approach. That you have already implemented these approaches should simplify the transition to a multithreaded app. The code that you have been extracting during your experimentation should hopefully map pretty well onto my imaginary -exifData and -thumbnail methods; note that my code did not make any changes to the mechanics of HOW the thumbnails are extracted/generated, instead just changing WHEN (and where) the generation occurs. You could really use either approach you gave above. My pseudocode in the previous message probably is more in line with the second approach, but you could trivially use the first as well. In either case, one little trick is that you will want to have a static placeholder thumbnail at the ready that your table can display until such time that the threaded code has the actual thumbnail finished. > I forgot to mention the really slow case: if a thumbnail can't be found > in the file, then I make a thumbnail from the main image. If this has to > be done on a lot of files, then things really bog down. But if the thumbnailing is on a second thread, this won't matter... just have the threaded code make the thumbnail. It's like magic, but better. :-) Give the concurrency programming guide a once-over and post back with follow-up questions; I think you will find that what you are trying to do is not as tough as it appears. - -- 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/ iD8DBQFOABbEaOlrz5+0JdURAhhWAJ9gakekUwXm8VyEC3zo5yXKeR47yACfVPZR JF4mJBazIwwz6S3ROgFMopI= =7QXU -----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