Re: NSOperation Efficiency
Re: NSOperation Efficiency
- Subject: Re: NSOperation Efficiency
- From: "Gerriet M. Denkmann" <email@hidden>
- Date: Wed, 05 Dec 2012 14:02:50 +0700
On 5 Dec 2012, at 11:41, Kyle Sluder <email@hidden> wrote:
>
> On Dec 4, 2012, at 8:00 PM, Jens Alfke <email@hidden> wrote:
>
>>
>> On Dec 4, 2012, at 7:33 PM, Kyle Sluder <email@hidden> wrote:
>>
>>> Yeah, it sounds like you're saturating the thread pool due to
>>> non-CPU-bound operations. NSOpQ is going to spend its entire time
>>> spawning and switching to threads while you append more and more
>>> operations to the queue.
I made a test project with this Operation:
@implementation GmdOperationBasis
- (void)main
{
if ( [ self isCancelled ] ) return;
double sum = 8;
for( NSUInteger i = 0; i < 13383333; i++ ) // takes about 100 msec.
{
if ( [ self isCancelled ] ) return;
double j = (double)i;
sum += sqrt(j);
};
}
@end
And got almost the same overhead (tested three times with 99 operations);
clock time per operation expected time overhead factor
// 8 ops 29.9, 30.1, 29.7 12.5 2.4
// 7 ops 29.2, 30.0, 29.7 14.3 2.1
// 6 ops 28.8, 28.5, 29.0 16.7 1.7
// 5 ops 28.6, 28.4, 28.9 20 1.4
// 4 ops 29.4, 31.9, 30.8 25 1.2
// 3 ops 35.7, 35.4, 35.2 33 1.06
// 2 ops 51.7, 51.5, 51.2 50 1.03
// 1 ops 100
Looks like NSOperationQueue has some problems, or?
Kind regards,
Gerriet.
_______________________________________________
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