Thursday, June 30, 2016

Re: Questions about how the GWT obfuscation process works



On Thursday, June 30, 2016 at 11:36:19 AM UTC+2, Jens wrote:
GWT first optimizes the Java AST, then converts it into a JavaScript AST and optimizes it as well. Once that is done the actual obfuscation is just a simple renaming as far as I know.

Once the optimization (aka tree-shaking; includes inlining, deadcode pruning, etc.) is done, code is also reorganized so it'll compress better with gzip ("sorts functions by size and clusters them by edit distance"); and obfuscation allocates obfuscated identifiers "in the original order of their declaration, which produces a lot more common substrings in the obfuscated output which significantly improves gzip/deflate compression."
(quotes come from commit messages)
See https://timepedia.blogspot.fr/2009/08/on-reducing-size-of-compressed.html about reorganization.

Also, up to GWT 2.7, there was an experimental flag to use Closure Compiler for the JS AST optimisation and obfuscation (it has been removed for GWT 2.8), which would use different algorithms and produce different results.

--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment