Hacker News new | past | comments | ask | show | jobs | submit login
Advanced Closure Compiler vs. UglifyJS2 (peterbe.com)
10 points by peterbe on Jan 22, 2016 | hide | past | favorite | 4 comments



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.


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.


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


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

https://github.com/google/closure-compiler/wiki/FAQ#closure-...




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: