32190

What is Closure Compiler?

If you have no idea what I am talking about, check this out: http://closure-compiler.appspot.com/home (it's a JavaScript minifier)

<hr>

On thier site, they state the following:

The Closure Compiler compiles JavaScript into compact, high-performance code. The compiler removes dead code and rewrites and minimizes what's left so that it downloads and runs quickly. It also checks syntax, variable references, and types, and warns about common JavaScript pitfalls. These checks and optimizations help you write apps that are less buggy and easier to maintain.

But can someone really explain in detail what this Closure Compiler does to my code?

Answer1:

Closure compiler will compile your code, and perform standard optimization techniques to your code.

The resulting code may or may not bear similarity when viewed superficially, but usually works exactly the same.

Answer2:

https://developers.google.com/closure/compiler/docs/compilation_levels

The ADVANCED_OPTIMIZATIONS transformations include:

    <li>

    more aggressive renaming: Compilation with SIMPLE_OPTIMIZATIONS only renames parameters and variables within functions. ADVANCED_OPTIMIZATIONS also renames global variables, function names, and properties.

    </li> <li>

    dead code removal: Compilation with ADVANCED_OPTIMIZATIONS removes code that is provably unreachable. This is especially useful in combination with large libraries. If you use only a few functions from a large library file, the compiler can remove everything except those functions from its output.

    </li> <li>

    global inlining: Compilation with ADVANCED_OPTIMIZATIONS replaces some function calls with the body of the function. This transformation is known as "inlining". The compiler only inlines functions when it determines that inlining is safe and saves space. Compilation with ADVANCED_OPTIMIZATIONS also inlines constants and some variables when the compiler determines that it can do so safely.

    </li> </ul>

Recommend

  • Are there any problems with nesting app-specific Backbone.js assets under common ones?
  • Can I get multiple different Meteor apps running reactively off the same MongoDB instance?
  • Dynamic controls: associated events don't fire if recreated during Page_Load
  • Best alternative to the 'title' attribute for storing data, like alternative meanings of w
  • Why are there differences in psych::principal between “Varimax” and “varimax”?
  • Why gcc does not produce type mismatch warning for int and char?
  • What to look for when setting UpdateBatchSize
  • java.lang.NoClassDefFoundError for org/springframework/aop/framework/AbstractAdvisingBeanPostProcess
  • How to use output buffering inside PHPUnit test?
  • Which reference source does include Microsoft.VisualBasic?
  • SIP Makefile fail (gnuwin and mingw)
  • Pointer vs Reference difference when passing Eigen objects as arguments
  • LNK1104: cannot open file 'kernel32.lib'
  • ZipList with Scalaz
  • Less Conflicting Session Manager for Zope 2
  • Alamofire and Reachability.swift not working on xCode8-beta5
  • Can my PDF ping my server when it is opened?
  • Pycharm: Marking a folder as 'sources root' is not recursive for subfolders
  • Cast between interfaces whose interface signatures are same
  • Question about instantiating object
  • Does Mobilefirst provide a provision to access web services directly?
  • ViewController With Transparent Background Entering Current ViewController With Push Transition
  • Email verification using google app script and google forms
  • Listbox within Listbox and scrolling trouble in Windows Phone 7 Silverlight
  • Disable Enter in editText android
  • C++ Partial template specialization - design simplification
  • Installing Hadoop, Java Exception about illegal characters at index 7?
  • Javascript simulate pressing enter in input box
  • C# - Is there a limit to the size of an httpWebRequest stream?
  • Is my CUDA kernel really runs on device or is being mistekenly executed by host in emulation?
  • Different response to non-authenticated users and AJAX calls
  • Controls, properties, events and timers running in design time
  • How to check if every primary key value is being referenced as foreign key in another table
  • Perl system calls when running as another user using sudo
  • Weird JavaScript statement, what does it mean?
  • How do you troubleshoot character encoding problems?
  • How to format a variable of double type
  • python regex in pyparsing
  • How can I get HTML syntax highlighting in my editor for CakePHP?
  • How to Embed XSL into XML