On Oct 29, 2016, at 02:37 , Jonathan Taylor <jonathan.tay...@glasgow.ac.uk> 
wrote:
> 
> The low priority thing only really runs  when *nothing* else at all is 
> happening.

This shouldn’t be happening, on most Macs. An average desktop Mac has at least 
2 CPU cores (4 logical CPUs), which should allow at least 2 compute-bound tasks 
to proceed simultaneously, provided they don’t have any accidental mutual 
dependencies, and provided the system overheads of changing the display at 60 
fps don’t amount to maxing out one of the CPUs. So you might want to spend some 
time in Instruments to get an idea of how your CPUs are getting used.

The other thing you should probably consider is what percentage of images 
you’re rendering but never pushing to the display, or rendering and pushing to 
the display too late. You might want to change to a more predictive model of 
what images to render.

You can also consider whether using a display link (CVDisplayLink) would help 
you decide what to render and when. A display link is basically a callback 
function that’s called at the display frequency. You may not want to render the 
low-res image on every display cycle, but you might be able to use the display 
link to rate-limit your calculations.

Finally, you should also pay attention to what kind of image you’re rendering 
in the background. If you’re creating a NSImage, it’s quite possible that vast 
amounts of CPU time are being spent copying the image data into a different 
pixel format and mapping colorspaces. It may be that using layer-based drawing 
works better for this sort of thing. If you really want to get into this, you 
could also investigate moving your image rendering into the GPU.

But I suggest you start with Instruments.

_______________________________________________

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