Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Image transformation chain reimplementation #417
TL;DR: I found a way to optimize resizing of JPEG-images significantly. Many changes had to be done in order to get this to work.
I was benchmarking Imagick against a different image backend and turned to Imbo to see how we had implemented the
Obviously I wanted to fix this in Imbo, but it turned out to be quite a lot of work:
To try and summarize the changes done in this branch:
To benchmark the old implementation against the new, I wrote a script that:
This is all done against a server running locally, so network conditions shouldn't have any say. I've reproduced the results multiple times with just small deviations. The result of resizing 900 images (300 * 3 iterations):
I think the results speak for themselves. Most importantly, this is a "free" optimization - it doesn't require any more disk space or configuration to set up. Obviously, this only applies to JPEG-images that is able to use the "shrink-on-load" trick, but I'm guessing most peoples image collection consists primarily of JPEGs anyway.
First and foremost, the
We should also give this some more testing in a production-like environment. Many combined transformations and order of these might provoke bugs, so we should also try quite a bit of transformation combinations before merging.