//
you're reading...

Software

News Anchor 2.4 beta

News Anchor 2.4 beta is out.. if you feel like you like being in the bleeding edge, you can download it from my DropBox folder (as long as its there).

Changes from the last version:

  • Performance improvements. Specifically the GUI should still be responsive even when you’re refreshing a lot of feeds.
  • Growl support. Finally you’ll get notified of refresh completions, new episodes, and feed refresh errors.
If you are a Mac App Store (MAS) customer, you’ll need to update to News Anchor version 2.3.1 and run it at least once for each machine that you plan to run this beta.  The MAS version of News Anchor will create a copy of the MAS receipt in a common folder that can be used by the direct-download version to authorize itself.  Special thanks goes to Daniel Jalkut who shown how to do this secondary authorization using MAS receipts.
Non-programmers may want to stop reading beyond this point.
How did I improve News Anchor’s performance? Apparently NSOperationQueue doesn’t really know what is the optimal number of threads to start for each operation. It looks as if it simply takes a look at the CPU load at the time an operation is added, and will start a new thread if it sees that the CPU still have some spare cycles left. 
The problem comes when you do a lot of network I/O in the operation objects and your Internet connection is slow.  You might potentially get hundreds of threads started and most of the threads will be idling away waiting to download stuff. The bad thing is that having many threads swamps the scheduler.  It may then allocate less CPU time for the very important main thread that runs the GUI, making the app looks frozen.
Anyway, I’ve worked around this in News Anchor’s background refresh operation by limiting the number of simultaneous operation that can be done:

Yes, it limits the number of threads taken by the refresh operation to twice the number of CPU cores. For dual-core machines, this means running a maximum of four threads at the same time. Keep in mind that the background refresh operation isn’t the only one that’s creating threads.  There are other threads that the CPU needs to service, that is the main thread, Core Data threads, and others created by the runtime environment. We need to limit our own appetite of CPU cycles and place a cap on the number of threads.
At testing, this actually works quite well and the GUI remains responsive even while News Anchor is refreshing many feeds and generating a lot of episodes.
Till next time..


Do you enjoy this post? Enter your e-mail address below to receive articles like this one in your mailbox.
* indicates required

Discussion

No comments yet.

Leave a Reply

Free Updates!

Learn how to grow your indie business while keeping your day job.

Categories

Archives

Keep updated!

Don't miss out on new articles!