3 ms·
Closure compiler in ADVANCED_OPTIMIZATIONS mode does this too. function add5(x) { return x + 5; } console.log(add5(3)); compiles down to
by leeoniya 9y ago
Closure compiler in ADVANCED_OPTIMIZATIONS mode does this too.
function add5(x) {
return x + 5;
}
console.log(add5(3));
compiles down to
console.log(8);
- danabramov 9y agoPrepack is doing much more than GCC can because it effectively evaluates the whole code and then serialises its heap. This is both its biggest strength and weakness. Unlike GCC, it can unroll any kind of metaprogramming, but it needs to have a model of the environment (e.g. it won’t execute code relying on DOM) and it can produce larger code (in terms of absolute size).