[WIP] Reduce the vanjs file size even more (by 48 bytes, minimized). #360
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
with1/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.
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.