On Jul 22, 2016, at 00:08 , Graham Cox <graham....@bigpond.com> wrote:
> 
> If the thread building images never goes faster than once per second, the 
> time to draw the image is a fraction of that - I’m sure 60fps is achievable, 
> so making the thread wait for the drawing to be done isn’t going to hold it 
> up significantly. 

(I’ve done something like this, though it was a couple of years ago, so the 
same performance characteristics cannot be assumed.)

With the sequence:

        worker thread -> NSBitmapImageRep -> main thread -> window

not even 24 fps was achievable, for anything but fairly small images (say, less 
than one quarter of a 21-inch non-Retina screen). That’s because a bitmap image 
rep isn’t the internal representation of anything, so there always a copy or 
two, along with a possible pixel format translation, and a colorspace mapping. 
Plus multithreading overheads like locks. The details will depend on the Mac, 
the OS version and the display.

If something performant is necessary, then the best approach is probably to use 
CVPixelBuffer instead. However, the learning curve for this is pretty 
horrendous, particular when dealing with isolated still images rather than 
video, so I would not suggest going there unless absolutely necessary.

OTOH, I’m not sure 60fps is being asked for, unless that comes from your 
special knowledge of what the app does. It was less than 1 fps per worker 
thread, and if there are 60+ worker threads, there are likely other performance 
issues as well.

_______________________________________________

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