xp-forge / frontend

Web frontends
1 stars 1 forks source link

Asset compression with -9 #21

Closed thekid closed 3 years ago

thekid commented 3 years ago

Use a compression level of 9 when compressing:

In all cases the file decompressed faster if it had been compressed with a higher compression level.

Source: https://www.rootusers.com/gzip-vs-bzip2-vs-xz-performance-comparison/

thekid commented 3 years ago

Savings in my case:

File Uncompressed Before After Delta
vendor.7b1f7cb.js 795.95 kB 231.68 kB 229.87 kB 1.81 kB
vendor.4d33b13.css 1330.04 kB 158.02 kB 154.79 kB 3.23 kB

We get about 3 kB of reduction, which isn't much, but it comes at virtually no cost when bundling, a slightly better runtime performance and if you multiply that times the amount of downloads, it might be noticeable:

image

See https://youtu.be/JfjiFsJsO4E?t=1213

thekid commented 3 years ago

We could potentially get even more savings by using https://github.com/kjdev/php-ext-brotli