The Google Closure Compiler compiles more efficient JavaScript. I can present some simple examples, such as the Closure Compiler, which reduce the call stack by calling functions directly or replacing constants with literals. But the documentation goes further, saying:
"The Closure compiler can use data type information about JavaScript variables to provide advanced optimizations and warnings."
My understanding was that typed languages ββhad two advantages: 1) type checking can catch errors during compilation - I can see how the Closure Compiler can mimic this behavior - and 2) the program actually runs faster because it compiled for another language (e.g. Java bytecode in Java). JavaScript still works with the Closure Compiler. How can it be optimized based on type information?
source
share