4 ms·
I'm wondering for some time if the minification could be done in a way that would help the gzipping achieve better ratios. For example if you have to minified
by yread 11y ago
I'm wondering for some time if the minification could be done in a way that would help the gzipping achieve better ratios.
For example if you have to minified function and one has three local variables and the other two it might be beneficial to minify it as "var a, b;var c;" if there are a lot of functions with two parameters a only one with 3. Or always assign "this" to a variable called "t" so that "t=this" (or "var t=this;") is repeated often.
This seems to be low hanging fruit but there is a lot of microoptimizations like that even if it saves <5% like this brute forcing it might be worthwhile.
- hawski 11y agoGoogle's Closure Compiler does something like this [1]. It also reminds me of Stack Overflow in 4096 bytes [2], where author also tried to write code that would compress more. [1] https://github.com/google/closure-compiler/wiki/FAQ#closure-compiler-inlined-all-my-strings-which-made-my-code-size-bigger-why-did-it-do-that https://github.com/google/closure-compiler/wiki/FAQ#closure-... [2] http://danlec.com/blog/stackoverflow-in-4096-bytes http://danlec.com/blog/stackoverflow-in-4096-bytes