Comment by jaffathecake

24 days ago

Well it obviously depends on the connection, but at 3g speeds and higher, the decoding time outweighs the fairly minor bandwidth saving.

And if you're displaying a cached image, the bandwidth use is zero, but the decoding still happens.

> And if you're displaying a cached image, the bandwidth use is zero [...]

But then less stuff fits in my cache, so I'm transferring even more data.

Also, not everybody has unlimited/unthrottled data plans. I really wish websites would respect my resource tradeoff preferences at least somewhat.

I dont know how you calculate that, but for my phone I get the payoff (given a 30% size reduction) to be positive below anywhere from 30-43Mbps.

When on celular, even 5g, I am pretty often below that.

  • https://random-stuff.jakearchibald.com/apps/img-decode-bench...

    Taking bike.jpg and bike-repackaged.jxl in that demo, on my Pixel 10 Pro in Firefox Nightly, the size and decoding times are:

    bike.jpg - 147 kB - 10ms

    bike-repackaged.jxl - 126 kB - 33ms

    So, I save 21 kB, but pay 23ms.

    That extra 21 kB isn't part of a new request, so when it comes to download performance, we're talking about an active response. At 3g speeds, in 23 ms you can download somewhere between 20-118 kB, so at best, it evens out.

    If it's a lower end device, the decode delta increases. If it's a faster connection, the 21 kB saving matters less. If the image was cached, then I'm just paying the decode overhead.

    • People really, really like to try to save up on the matches, so to speak. Sometimes literally: there was a short period of time during Khrushchev's rule in the USSR when the natural gas was made free for the populace. Well, the matches still cost money (1 kopeck for a box of 50 matches), so lots of people would just not turn the stove off, instead always having it burning the smallest possible flame when not in use.

      All that to say, "I save 21 kB, but pay 23ms"? You'll save more if you stop sending your favourite web font over with your page and use the system fonts, and trim down your site's JS.