Re: Retrieving the EXIF date/time from 250k images
site_archiver@lists.apple.com Delivered-To: cocoa-dev@lists.apple.com Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mac.com; s=1a1hai; t=1660680054; bh=+yCGKlhiO9pZmP05qLfL+FYTlrX/HRw7dti+mVlMKes=; h=From:Content-Type:Mime-Version:Subject:Date:To:Message-Id; b=aCjdS+7KG4Iy7ITgHgrVtnbARvHQci47Dl2ZRm7CdQHAhk+nlypja4SupyKYvljp/ 5l19e/37SKpsxgv8sjVL+zsBXAkOvZZAXjaf1IUtnzDqFGzUG6s0wUcdBUshUA9bbE wve71nz7aIP41FsvXcSryobQNUxMpxsmmmr0iVfCVu2JxuBRHS7eYdNc5GK3k2agzn 4zr2qgIFe81LKA97yUh5cGroSHyRZ5RlcUXZXnjUROey8+Vzp971OiUC+t5I62VRo2 PtWKH/fIrhd8PQyGVDhOiSyID/j++zAwXsMUN9DbRwCEgYyFutSp3TytTGL5W2GyJa W0Om4x6ZPHUpg== I love experimenting with processes like this. Create as many operation processes as you have cores on your box and run a few tests to see how quickly the operations complete. Try it with 2x the number of cores, 1x the number of cores, 1/2 x the number of cores and the number of cores + 1 and the number of cores - 1 to see if there are any substantial differences in time to completion. But as the others have said, GCD and NSOperationQueue were made for these things. If you’re actually trying to get work done and not researching for your own benefit, those are the ones to use. They do all the heavy lifting for you are are easy to implement. Cheers. Alex Zavatone
On Aug 16, 2022, at 2:37 PM, Jack Brindle via Cocoa-dev <cocoa-dev@lists.apple.com> wrote:
Instead of using NSOperationQueue, I would use GCD to handle the tasks. Create a new Concurrent queue (dispatch_queue_create(DISPATCH_QUEUE_CONCURRENT)), then enqueue the individual items to the queue for processing (dispatch_async(), using the queue created above). Everything can be handled in blocks, including the completion routines. As Christian says the problem then is that data may not be in the original order so you will probably want to sort the returned objects when done. This should significantly speed up the time to do the whole task.
Jack
On Aug 16, 2022, at 12:26 PM, Steve Christensen via Cocoa-dev <cocoa-dev@lists.apple.com> wrote:
You mentioned creating and managing threads on your own, but that’s what NSOperationQueue —and the lower-level DispatchQueue— does. It also will be more efficient with thread management since it has an intimate understanding of the capabilities of the processor, etc., and will work to do the “right thing” on a per-device basis.
By leveraging NSOperationQueue and then keeping each of the queue operations focused on a single file then you’re not complicating the management of what to do next since most of that is handled for you. Let NSManagedObjectQueue do the heavy lifting (scheduling work) and focus on your part of the task (performing the work).
Steve
On Aug 16, 2022, at 8:41 AM, Gabriel Zachmann <zach@cs.uni-bremen.de> wrote:
That is a good idea. Thanks a lot!
Maybe, I can turn this into more fine-grained, dynamic load balancing (or latency hiding), as follows: create a number of threads (workers); as soon as a worker is finished with their "current" image, it gets the next one (a piece of work) out of the list, processes it, and stores the iso_date in the output array (dates_and_times). Both accesses to the pointer to the currently next piece of work, and the output array would need to be made exclusive, of course.
Best regards, Gabriel
_______________________________________________
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: https://lists.apple.com/mailman/options/cocoa-dev/jackbrindle%40me.com
This email sent to jackbrindle@me.com
_______________________________________________
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: https://lists.apple.com/mailman/options/cocoa-dev/zav%40mac.com
This email sent to zav@mac.com
_______________________________________________ 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: https://lists.apple.com/mailman/options/cocoa-dev/site_archiver%40lists.appl... This email sent to site_archiver@lists.apple.com
participants (1)
-
Alex Zavatone via Cocoa-dev