Cocoa Programming for OS X: The Big Nerd Ranch Guide
by Aaron Hillegass, Adam Preble, Nate Chandler
For the More Curious: Faster Scattered
The goal in this chapter was to make Scattered a better-behaved application by moving heavy lifting off the main thread. You did not, however, fully address the performance issues with this application. If you were watching closely, you may have noticed that you limited the number of concurrent operations in processingQueue to four. If you remove that constraint (by commenting out the line), you may find that Scattered runs somewhat faster, or you may find that it runs even slower. What is going on here?
One of the most useful features of Grand Central Dispatch (GCD), which NSOperationQueue is built upon, is that GCD manages the number of running operations (threads) based on the system’s hardware ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access