
Advanced Closure Compiler vs. UglifyJS2 - peterbe
http://www.peterbe.com/plog/advanced-closure-compiler-vs-uglifyjs2
======
yoklov
Closure compiler advanced mode is an optimizing compiler that will perform
several nontrivial transformations while also making your source smaller.
Uglify is a minifier, and just makes your source smaller.

Apples and oranges comparison. Of course the technology that does more will be
slower, especially when the 'more' requires a great deal of analysis on the
input.

Note: I'm not saying closure compiler is better, I actually tend to think that
it is not for most usages, as the language it compiles is 'pretty much but not
really javascript', and the difference there makes it hard to add into an
existing build process with confidence.

~~~
Silhouette
The difficulty I found with Closure Compiler was that there were instances of
valid, working JS code that it didn't (and in some cases probably couldn't)
reliably process. Consequently, you had to follow stricter conventions about
things like writing object literals than the language itself required.

That was enough for the projects I'm thinking of to decide a relatively simple
minifier like Uglify was a better choice for their specific situations. Now
that a lot of pre-optimisation JS is the output from one transpiler or
another, that might be more of a practical limitation.

~~~
yoklov
That's basically what I mean by 'pretty much but not really javascript'.

------
julian37
Worth noting that Google Closure Compiler specifically optimizes for post-gzip
size:

[https://github.com/google/closure-
compiler/wiki/FAQ#closure-...](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)

