Thursday, June 30, 2016

Re: Questions about how the GWT obfuscation process works

GWT first optimizes the Java AST, then converts it into a JavaScript AST and optimizes it as well.

I had a sneaking suspicion the obfuscation might not be working off human-readable JS. Neat.

Once that is done the actual obfuscation is just a simple renaming as far as I know.

Ah, right.

Its also kind of worthless doing such a compression as you have mentioned because that is exactly what GZIP compression does when activated on your web server.

I was wondering whether it made that much of a difference with gzip configured. As Thomas Broyer noted, GWT reorganizes the code so it fits better into gzip's sliding window and gets compressed more readily.

As an aside, I recently learned just how much gzip makes a difference:

The obfuscation is not a standalone tool so you can not run it against any JS library.

Duly noted.

In the future it is likely that GWT use a different compiler called J2CL (in development inside Google) which takes the Java code and directly converts it to ES6 JavaScript classes in a way that they are really good understandable by Google Closure Compiler.

Interesting! Thanks for the headsup!

Then JS optimization + minification will be done by Google Closure Compiler which you can of course use for any JS library as well.

I just had a look at the Closure Compiler web service and fed it some JS I was recently golfing. To quote, it "Saved -68.96% off the gzipped size (-107.55% without gzip)", although in all fairness it did give me some possible ideas for saving a few bytes.

So the minification/obfuscation you are seeing today in GWT will likely change in the future.

 I see. I'll keep an eye out for the changes! :)

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