Today we made Pedal Room even faster!
Recently, we realized that some of our small thumbnail images are way bigger in file size than they should be. We were seeing 48x48 pixel images that should be around 2 kilobytes actually being as big as 67 kilobytes.
We figured out the problem almost instantly - we'd forgotten to strip color profiles and comments out of images as we sized them down to create thumbnail images.
So today we fixed the code to strip the extra data out of images when we resize them. From now on, all photos added to Pedal Room will be missing this extra data. This is good - the photos will load faster and will look the same as before. That solved part of the problem. However, this was only part of the problem - the existing images on the server still needed to be optimized.
So we wrote some scripts that run on the server and optimize existing images. Basically, the script converts all images, one-by-one. For each image, if the converted image has a 5% or greater reduction in filesize, we throw out the original and replace it with the optimized version.
For every one of the thousands of thumbnail images we optimized, we reduced file size by an average of 62.7%. For the tiny 48x48 pixel images on the site (the ones you see on the home page in the random photos area for example), we saved 28.7 megabytes. Massive savings were also made elsewhere, including in the regular thumbnails.
This translates into faster load times, and reduced server load and hosting costs. Win win!