Re: NSOperation Dispatch Thread Soft Limit
Re: NSOperation Dispatch Thread Soft Limit
- Subject: Re: NSOperation Dispatch Thread Soft Limit
- From: Jens Alfke <email@hidden>
- Date: Mon, 03 Mar 2014 08:14:12 -0800
On Mar 3, 2014, at 12:43 AM, Gerriet M. Denkmann <email@hidden> wrote:
> MyOperation does:
> create an NSOperationQueue
> add a few MyOperations to this queue
> waitUntilAllOperationsAreFinished
> (obviously this recursion stops at some point - I do not create an infinite number of operations).
NSOperation already has dependency settings so you can tell an NSOperation not to start running until dependent operations finish. You should be using that instead. Having large numbers of NSOperations blocked in mid-flight is bad for scalability, as you found, because it creates lots of threads.
It sounds like you’ve implemented some hierarchical algorithm in the simplest possible way. (Which is not an insult; one of the Agile principles is Do The Simplest Thing That Could Possibly Work.) The flip side of this approach is that when profiling shows you that the simple approach isn’t good enough, you have to go back and redesign it in a cleverer/faster way.
—Jens
_______________________________________________
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