Optimize your JavaScript code by eliminating dead code areas, checking the syntax and the variable references with this Google-signed compiler.
- Closure Compiler
- Version :20170626
- License :Apache License 2.0
- OS :Windows All
- Publisher :Google
Closure Compiler Description
Code optimization is an important step in programming and web development since cluttered code usually leads to wasting resources, such as memory and computation time. JavaScript programmers can resort to Google’s Closure Compiler to parse their source code and ensure it is efficiency executed.
Code checking and minimization
Closure Compiler is not actually a compiler in the traditional way, as it does not translate code from JavaScript (the source language) to machine-friendly code. Instead, it thoroughly analyzes the entire JavaScript source code, checking for errors, illegal syntax sections, and dangerous operations. In other words, it is a tool that can produce better, optimized JavaScript code, with fewer bugs and faster computation speed.
Aside from bugs and errors, dead code sections are eliminated, and the remaining lines are re-written by Closure Compiler and minimized as much as possible by renaming basic symbols or parameters and removing unnecessary elements, such as comments or white spaces. The syntax is verified along with variable references (invalid ones are removed), data types are checked, and common errors are highlighted.
Faster code execution and optimized loading time
A consequence of code checking is the significant increase of the code efficiency. The size of the ‘compiled’ (optimized) JavaScript files is reduced, so the final web application or object requires less bandwidth and loads faster in the browser. In this process, the code functionality is not affected in any way.
The generous array of functions that Closure Compiler comes with allows you to use additional optimization options based on different assumptions of the compiler. Furthermore, you can create renaming reports to be aware of the new names of the parameters inside the code, enable debugging, change formatting, modify the logging level, select the output language and many more.
Achieve code compression in an easy manner
Closure Compiler parses JavaScript code, optimizing it and increasing execution efficiency. From simple optimizations, such as comment and unneeded space removal or name shortening, to in-depth transformations (dead code removal, global inlining), you can do it all with this application.
However, if you go for the advanced optimization and, therefore, the highest code compression level, you must be aware of the assumptions Closure Compiler makes during parsing. Otherwise, you risk having your code rendered unusable.