Re: Retrieving the EXIF date/time from 250k images
Re: Retrieving the EXIF date/time from 250k images
- Subject: Re: Retrieving the EXIF date/time from 250k images
- From: Jack Brindle via Cocoa-dev <email@hidden>
- Date: Tue, 16 Aug 2022 14:37:06 -0500
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
> <email@hidden> 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 <email@hidden> 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 (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
_______________________________________________
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