4 ms·
It makes sense to pre-compress the static assets. Then the server can load the compressed ones directly, without requiring to link to the compressor, and of cou
by motiejus 4y ago
It makes sense to pre-compress the static assets. Then the server can load the compressed ones directly, without requiring to link to the compressor, and of course pay the price of online compression.
I create two extra files for each static file (for some extensions):
file
file.gz <-- with zopfli
file.br <-- with brotli
And the web server, depending on the `Accept-Encoding` header, would serve the right file.
The wasm module:
$ ls -lh fiddle-module.wasm*
-rw-r--r-- 1 motiejus motiejus 779K May 26 15:25 fiddle-module.wasm
-rw-r--r-- 1 motiejus motiejus 323K May 26 15:25 fiddle-module.wasm.br
-rw-r--r-- 1 motiejus motiejus 357K May 26 18:00 fiddle-module.wasm.gz
- sgbeal 4y ago> And the web server, depending on the `Accept-Encoding` header, would serve the right file. This web server (also part of the sqlite family of projects) doesn't yet know how to do that. https://sqlite.org/althttpd https://sqlite.org/althttpd
- chrismorgan 4y agoInteresting comparing the sizes of different compressors. `gzip -9` gets to 374K, whereas you report zopfli taking it down to 357K. And I had at first run `brotli -9`, being fairly confident in my memory that it had more than nine levels, but finding -h mentioning -# as 1–9, and not seeing --best (level 11) at the other end of the output, and that that’s the default (unlike gzip where I think the default is mostly 6), so that -9 actually makes it do a worse job. Sigh.