From a performance perspective, it would be great if /swatches/ajax/media can accept a batch request and return all available media for all products in one call. On a product page, it isn't such an issue. However, when a swatch option is selected in layered navigation, a /swatches/ajax/media call is done for every single product in the catalog view.
Additionally, a catalog page view with a selected swatch option that updates thumbnails doesn't cache the updating of the thumbnails thus requiring dozens of calls to /swatches/ajax/media on every load and a considerable delay in rendering the updated thumbnails. The thumbnails are cached, however the bottleneck becomes the multiple calls to /swatches/ajax/media.
Performance with Single Call
When a swatch option for an individual product is clicked in catalog view and the thumbnail is updated for a single product, I've been able to get TTFB for the /swatches/ajax/media ajax call down to 400-500ms with PHP and MySQL optimization. (MySQL query cache also enabled)
Performance with Multiple Calls
When a swatch option is selected in layered navigation and that option is set to update thumbnails, it forces a refresh of all the thumbnails in the catalog view on every load. So say we have a total of 20 items, then /swatches/ajax/media is called 20 times. Since calls are happening with page load, TTFB for first /swatches/ajax/media is 700-900ms (compared to single call of 400-500ms in previous tests). But it gets worse, we run into the browser's maximum concurrent requests per host limit (which in Chrome is 6), so only 6 simultaneous calls are executed and each has a longer TTFB than the previous call. By the 3rd call, TTFB is 1.4-1.7s. And since we have 6 active requests with most taking longer than 1s, the other 14 requests are waiting
Ideally, /swatches/ajax/media should accept parameters composed of a batch of products so that then only 1 request is needed to retrieve media information for all the products in the catalog view instead of having to do dozens of simultaneous calls.
Another solution, although probably more complicated to implement would be to somehow cache the swatch option initiated thumbnails (ie. non ajax method) along with the page so performance would be as quick as the default view without swatch options selected. Without a swatch option selected, our page load for 20 items is 300-350ms TTFB and loads in 1.5s. With a swatch option selected requiring updating all thumbnails, TTFB is 300-350ms with a load in 6.5s-7s (most of that taken up just by requests and responses to /swatches/ajax/media). The actual downloading of the thumbnails (without browser cache) is almost unnoticeable (about 40ms per image)
Or perhaps a hybrid solution. Layered navigation initiated swatch options (ie. option is in URL query) updating thumbnails/images should not be ajax initiated and instead rendered with the page to take advantage of FPC. But if a swatch button for an individual product is clicked, then handle it via the ajax call.