Re: Prioritizing drawing of the important stuff
Re: Prioritizing drawing of the important stuff
- Subject: Re: Prioritizing drawing of the important stuff
- From: Quincey Morris <email@hidden>
- Date: Sat, 29 Oct 2016 10:41:30 -0700
- Feedback-id: 167118m:167118agrif8a:167118sFZOcWj4my:SMTPCORP
On Oct 29, 2016, at 02:37 , Jonathan Taylor <email@hidden> 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 (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