Power Consumption of JPEG, WebP, and AVIF
fershad.com
fershad.com
Interesting, my location has "high grid intensity", so it showed me a lite version, with low-res images and some JS <script> tags commented out.
But the author explains the steps to determine this:
1. A Cloudflare Worker checks the request object for the country a visitor is located in.
2. If a location is found, then a fetch request is made to the CO2signal API CO2signal sends back data about the current grid intensity at the visitor's location.
3. The current grid intensity is checked against the annual average grid intensity for that country (data from CO2.js).
4. If the grid intensity is equal to or greater than the annual average, then the HTML response is modified using the Cloudflare Workers HTMLRewriter. If the grid intensity is less than the annual average, the regular (unmodified) site is returned to the user.
(https://fershad.com/carbon-aware-site/)
Surely all these steps combined above use more power than just sending the unchanged HTML page to the user?
But to decide whether this approach works, we should first test it, improve it, and then we can benchmark it.
I find the idea interesting. Could be cached for all pages, or handled by the browser. It would be massively interesting in gaming and streaming, helping also support old devices better.
http://www.caiso.com/TodaysOutlook/Pages/emissions.html
So the data might be wrong as well which may mislead the user.
Tweeted at him here: https://x.com/edwardstarcraft/status/1695508531028566090
Now that I think about it, I'm wondering whether Google could change electricity prices by e.g. flipping a switch on YouTube H.264 availability in a particular region...
The only question is really step 2: How much work is required to communicate with the CO2signal API? If that API is also in a Worker and/or is able to make good use of the local Cloudflare cache then it might be quite cheap. If it has to talk to an external server somewhere then it's hard to say.
With all that said, presumably the net effect is negligible either way and the real goal is to raise awareness and demonstrate how these APIs could be used.
(disclosure: I'm the lead engineer for Cloudflare Workers.)
Well one has to consider the power used to transmit the files. If I had to guess the power to transmit is much higher than the CPU rendering power and one should just optimize for smaller file sizes while keeping image quality and rendering time acceptable.
For the usual person to get that file on the internet, one needs the processors of about 20 routers/switches and the like to move the data back and forth, the data has to go through a couple of hundred of kilometers of distance (at least) on fiber optic, the signal being generated by power hungry lasers, etc.
This article is kinda funny and quanit with it's carbon calculations while ignoring the biggest difference in power use.
(besides saving recipients' data budgets)
(One should also account for the energy spent bookkeeping all energy expenditure)
Say you upload a high res source image to Cloudinary (or similar), then it gets requested in multiple sizes… each size will need to be generated.
Each generated version might be cached for a while but then at some point will get evicted so will need to be regenerate when someone requests it
I’ve worked with sites where this is exactly the case
They could cut their resource usage further, beyond that of the power-saving version of their site, by getting rid of the power-saving detection behavior. Just do the sensible version all the time.
Their actual HTML is pretty clean.
Of ALL the problems with environmental sustainability, you picked this one...
Jpegli will make smaller jpegs that are faster to decode.
Why didn't the blog just compare the speed of those algorithms? Power consumption is just calculated by multiplying the runtime by a constant here, it's not measured by a power meter or anything....
In some special cases multiplying runtime might be enough to achieve some accuracy, but that’s not the whole story.
It would be interesting to see this experiment done so that the decode is done enough times for each format so the power consumption differences could actually be measured on a power/watt meter.
For those who like SI base units: 100 µWh is 360 mJ.
I'd like to see an ideal comparison using hardware-based decoders all from the same vendor and the same manufacturing process node.
But I would also expect JPEG-XL to score worse than Webp and old JPEG at the moment because it is newer and implementations could therefore yet be less optimised.
I wouldn't consider WebP over JPEG for lossy compression of photographs: https://siipo.la/blog/is-webp-really-better-than-jpeg
Having a quick look at squoosh, it uses lossy compression of webp by default.
I wish, there is still occasionally some weird behavior, like when you take an image from Reddit that's a WebP file and try to past it into WhatsApp through the clipboard. It doesn't upload as a regular photo that you could add a comment to or edit it, but instead as a file, even without a proper thumbnail preview. Super annoying and I don't think that there are that many good reasons for this to be a thing.
Then again, if you don't care about use cases like that and just want to store images on you website, you can probably just pick what seems like the best option for your own needs. I'd go with JPEG or PNG just because they've been around forever, at least for as long as I don't have to worry about bandwidth too much.
Though really I'm not sure this question makes sense in the first place. Optimizing the power used by the client during decode specifically seems unlikely to be the best way to optimize power usage of the website transfer. In particular, optimized transfer time of the same fewer total bits to all clients should far outweigh any savings from using a lighter-to-decode image format.
Video would be a whole different world. I wonder how the energy efficiency of different hardware decoders compares for even the same format.
Like what amount of energy could you save with the leverage of iOS/Android if people were to opt-out of energy-saving mode
I had a page that was showing a few thousands DVD covers (in jpg, around full hd resolution), it crashed all browsers except opera presto.