van
van copied to clipboard
[WIP] Reduce the vanjs file size even more (by 48 bytes, minimized).
Just for fun and pushing the limit on readability...
This removes all the redundancy in the code, and using some technics seen in #359 to reduce the minimized file size by 48 bytes. Unfortunately, this doesn't reduce the gzip'd file size, unless using Zopfli for compression (but don't be too optimistic, see below)
Also replaced Infinity
with 1/0
(didn't test alone if it compress better with gzip)
EDIT: Tested, it doesn't make any difference, the minimizer already implement this trick.
Right now, here are my attempts at reducing the VanJS package to the absolute minimum without changing any of the algorithm.
Version | Min file size | Gzip size | Zopfli size | Brotli size |
---|---|---|---|---|
1.5.2 | 2022 | 1048 | 1017 | 935 |
this PR | 1974 | 1074 | 1042 | 968 |
Zopfli is a gzip compatible compressor that compress better than gzip. It allows to get a vanjs package below 1kB (with 0 effort, just replace the call from gzip to zopfli). Brotli is a web standard compressor that's only available on HTTPS, but that compress a lot better than you would expect. It's supported on all major browser, so it's definitively the way to go if you serve a HTTPS website. For obscure reasons linked with Google will to force HTTPS into all users mouth, it's not available on HTTP, sadly.
Just a remark, if one is bundling all the modules of her webapp, having a smaller one might gain final bundle size too (unlike here) because there will be more context to compress from.