During this experience, I learned that the size of this image greatly influenced how fast Emacs loaded, for obvious reasons. But that made me wonder, does the format matter? Webp is claimed to be faster for websites, but what image format is fastest on Emacs?
replace the list of placeholder paths with the actual image paths you want to benchmark. You should see the different loading times in your Messages buffer:
Time to load /home/wilko/devel/tmp/benchmark-img/emacs-logo.jpg: 0.001378 seconds
Time to load /home/wilko/devel/tmp/benchmark-img/emacs.png: 0.000744 seconds
Your test shows png getting loaded faster, am I interpreting the numbers right?
My test shows that the particular .png I choose loads faster than the particular .jpg I compared it to. This doesn’t always have to be the case (iirc .png decompression should be slower than jpeg decompression for a technically similar image, but then again I’m no expert when it comes to the technical details on how image decompression works).
The elisp snippet is meant as a benchmark that can be used to asses the loading times of different versions of the icon artwork, so it’s easier to choose which one to use on a dashboard that gets loaded when one starts Emacs. One could use it to bench technically similar images as well, but that’s not what I did in my example (probably should have! the test images are just visually the same, meaning they depict the emacs logo/the same thing, but technically they’re of different size and scale).