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)

Thanks for the link - this is really interesting reading.
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.

 Was the flag removed in preparation for J2CL?

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
To post to this group, send email to
Visit this group at
For more options, visit

No comments:

Post a Comment