On Sep 29, 2016, at 01:05 , Gerriet M. Denkmann <g...@mdenkmann.de> wrote:
> 
> Well, nothing. Just let’s call it nbrOfBlocksToBeUsedByDispatchApply, or 
> whatever. But ultimately any of these things has to run on a CPU, of which 
> there are no more than 8.

Well, here’s my narrative. It may be fiction or non-fiction.

You said you tried “nbrOf…” as a few ten-thousands, vs. 8. Let’s be concrete 
and call this (a) 40,000 vs. (b) 8. So, for each set of 40,000 iterations of 
your block, you’re doing 1 dispatch_apply in case #a, and 5,000 dispatch_apply 
calls in case #b. So, you’ve established that 4,999 dispatch_apply calls — and 
related per-dispatch_appy overhead — take a long time.

Of course, I’m relying on the fact that you’re doing the same number of *total* 
iterations of your inner loop in case #a and case #b. This is not quite the 
whole story, because there are loop setup overheads per block. However, the 
loop setup that you’ve shown is very simple — a couple of Int operations — so 
the additional 4,999 loop setup executions are likely dwarfed by 4,999 
dispatch_apply executions.

>> Isn’t this what Instruments is for?
> 
> Might be. I already looked at Time Profiler, but failed to notice anything 
> (maybe was looking at the wrong things) and System Trace, but did not 
> understand what to observe or what the Instrument was telling me.

Unfortunately, I agree, Instruments is inscrutable initially, and has a nasty 
learning curve. You kind of have to persist, poking around till things start to 
make a little sense. Since you want to know where time is being spent, Time 
Profiler sounds like the right place to start.

One possible approach is to profile case #a and case #b, and compare the 
Instruments output. Since you know what the actual performance difference is 
(in general terms), you should be able to see that reflected in what 
Instruments tells you. That should give you some reference points.

_______________________________________________

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/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to