16. Graphics and UI: Pitfalls and Techniques

Fast graphics programming is, in effect, an entire industry unto itself with many books worth of techniques and much more lore passed around online, so we can’t possibly cover it exhaustively nor even do it justice. For example, we will be taking at best a cursory glance at OpenGL. What we can do is look at techniques that work for non-game end-user applications using the regular graphics stack.

Pitfalls

For responsiveness, one of the biggest pitfalls is to perform long or unpredictable operations on the main thread. This includes all I/O, because as we saw in the previous sections, even the smallest I/O operation can potentially take a long time. On the other hand, just putting operations in the ...

Get iOS and macOS™ Performance Tuning: Cocoa®, Cocoa Touch®, Objective-C®, and Swift™ now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.