As I mentioned previously, I try to have a core focus for each version of Portfolio. For version 4.1.0 that focus was performance.
Portfolio 4 brought with it a brand new image viewer (well, not quite brand new – it was taken from Studio Pro and extended to support other media types). This was done to make it more future-proof for coming iOS updates but it also meant it didn’t preserve the performance optimizations that had been made to its previous viewer over the years.
Profiling the app pointed at image loading as the major culprit, particularly when operating on 11 MP images (that’s a lot of data to load quickly and maintain app responsiveness). This piece alone took a significant amount of time between benchmarking iOS image performance and ultimately building a better cache. I also reworked the viewer to start preloading neighboring items when browsing images since in most cases one of those is the next to be viewed.
Using the time profiler in instruments also pointed to another area: gallery preview images. In all previous versions of Portfolio the gallery/folder preview image has had to be manually set – starting with Portfolio 4, unset galleries and folders will use the first item found for the thumbnail. This led to a slowdown when there were a large number of galleries and folders generating their thumbnails at the same time.
Fixing this meant shuffling the work of loading the thumbnail off the main thread to keep the interface responsive. In this and many other areas, GCD is one of the best things ever to make it into iOS development.
This update also included a few fixes for problems reported by users, notably with slideshow music playback and Dropbox syncing.
Release Notes
Changes
- Added smarter image loading to help improve viewing performance.
- Switched to a different caching system to improve performance.
- Browsing now starts a preload on neighboring items.
- Added a check to avoid generating an additional image size if no crop is indicated.
- Reworked gallery thumbnail loading to improve performance.
- The sync configuration area can now run a test sync and return a log of the results.
Fixes
- Fixed a bug that could cause the intermediate size of an image to load incorrectly.
- Toggling the viewer mode while in fullscreen now updates the layout correctly.
- Closing the backup/restore panel is fixed.
- Fixed a bug that caused music playback in a slideshow to stop after the second song.
- Fixed a possible crash when syncing at the gallery level.
- Syncing should now abort if unable to retrieve a full file listing from the sync source.
- Optimized JPG image loading to skip the alpha channel when preparing for display.