One of the DropSync’s nicest features is it’s Activity window. The idea is that by opening this window you can look up a complete history of what changes have been made for any of the folders or files under DropSync’s control. In the shipping version of DropSync this mostly works, except when you start to get lots and lots of items in your history. Actually, the number of items where this performance hit kicks in is embarrassingly small.
For quite some time now, this has been a problem that’s nagged me. Recently though, I started implementing automated syncing for DropSync, which of course makes it easy to generate thousands of history entries. This mean’t that the performance limits of my Activity window went from being annoying to critical.
Originally I had implemented the Activity window as an NSCollectionView. I did this, partly because it was easy to do, but also because NSCollectionView provides really nice animations for free. Unfortunately though, it doesn’t scale well to large numbers views, and it also doesn’t play that nicely with core-data backed NSArrayControllers.
Eventually I discovered a much better solution, PXListView by Alex Rozanski which works much like UITableView on iOS. Alex explains the motivation behind PXListView really nicely in this blog post. In summary, the key to the performance gain comes from re-using views and keeping only the minimum number required for display in memory at any one time.
In my case, switching to PXListView has meant that I can now realistically handle hundreds of thousands of history entries instead of just a few hundred. I was able to keep all the benefits of having a view based list, including binding the controls in my view items to corresponding properties of objects in an NSArrayController.
Thanks very much Alex Rozanski for contributing this great bit of code to the community.