Compression: brotli, gzip and the flags nobody sets
Brotli at its default level is barely better than gzip. At level 11 for static files it is a different story.
Almost every server that supports brotli ships it at a low compression level, because the level that matters for dynamic responses has to be fast. For static assets, which you compress once at build time, that constraint does not apply.
- Pre-compress static assets at build time, at the maximum level.
- Leave dynamic responses at a low level. The CPU cost is real.
- Check what your CDN is actually serving. It may be recompressing you.
On a typical bundle the difference between default and maximum brotli was 14% of transfer size, for no runtime cost at all.