Conversation
090621e to
665bcfe
Compare
We can save 10 kB of binary size by compressing the frontend using brotli on max settings instead of gzip. Any browser beyond 2017 will be able to handle this, and since the Tailwind upgrade we already require browsers from 2024. (see also #903) Also we can stop using whatever gzlip cli is on the system, node has some stuff builtin. Source for the claim we require chrome 2023/firefox 2024 baseline right now: https://tailwindcss.com/docs/compatibility Compression comparison: | codec | size (bytes) | vs gzip -9 | wire format | `Content-Encoding` | |---|---:|---:|---|---| | (uncompressed) | 171,833 | +210.6% | — | — | | gzip -9 | 55,313 | — | gzip | `gzip` | | pigz -9 | 55,436 | +0.2% | gzip | `gzip` | | brotli q=4 | 55,085 | -0.4% | brotli | `br` | | brotli q=6 | 51,518 | -6.9% | brotli | `br` | | brotli q=9 | 51,243 | -7.4% | brotli | `br` | | **pigz -11** (zopfli) | **53,340** | **-3.6%** (~2 KB) | **gzip** | `gzip` | | **brotli q=11** | **47,712** | **-13.7%** (~7.4 KB) | **brotli** | `br` |
665bcfe to
533221d
Compare
|
i'm not necessarily opposed to this, but i wonder if a 0.2% reduction in size is worth making this change? |
|
going from |
|
maybe i'm misunderstanding, but isn't 10kb off the main 5.1MB binary less than a percent of savings? |
|
You are talking past each other, its reducing 13% off the size of the web page and 0.2% of the size of the total binary. But here's my question, is brotli harder on the serving CPU than gzip? That's a bigger constraint than the web page size IMO . |
The payload is compressed and served as-is by the daemon. The daemon does not decompress or recompress (shipping a brotli compressor would blow up the binary size by way more than what we could save here). That's why changing the compression type is directly tethered to what browsers can be supported. |
We can save 10 kB of binary size by compressing the frontend using
brotli on max settings instead of gzip. Any browser beyond 2017 will be
able to handle this, and since the Tailwind upgrade we already require
browsers from 2024. (see also #903)
Also we can stop using whatever gzlip cli is on the system, node has
some stuff builtin.
Source for the claim we require chrome 2023/firefox 2024 baseline right
now: https://tailwindcss.com/docs/compatibility
Compression comparison:
Content-Encodinggzipgzipbrbrbrgzipbr