Re:Show HN: Faster.js – a micro-optimizing JavaScript compiler
by RubenSandwich on Friday April 20, 2018 @01:48PM
(#16886878)
Prepack, https://prepack.io, is also in the same realm of an optimizing Javascript compiler.
[ Parent
| on HN ]
Re:Show HN: Faster.js – a micro-optimizing JavaScript compiler
by abritinthebay on Friday April 20, 2018 @02:30PM
(#16887299)
Prepack is somewhat different though in that it precalculates what can be. That's much less problematic than what the linked library does.
Of course prepack also isn't even close to production ready yet either.
Re:Show HN: Faster.js – a micro-optimizing JavaScript compiler
by k__ on Friday April 20, 2018 @01:50PM
(#16886897)
Prepack is rather nice. It allows you to execute part of your code at compile time, like a macro.
Re:Show HN: Faster.js – a micro-optimizing JavaScript compiler
by leeoniya on Friday April 20, 2018 @02:01PM
(#16887016)
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);
Re:Show HN: Faster.js – a micro-optimizing JavaScript compiler
by danabramov on Friday April 20, 2018 @04:13PM
(#16888124)
Prepack 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).
Re:Show HN: Faster.js – a micro-optimizing JavaScript compiler
by yoklov on Saturday April 21, 2018 @01:33AM
(#16890130)
I would avoid using the name GCC to refer to the closure compiler, since there's already an extremely well-known compiler named GCC.
Admittedly it doesn't take JS as input, but I was somewhat confused when I read your comment nonetheless.
Re:Show HN: Faster.js – a micro-optimizing JavaScript compiler
by leeoniya on Friday April 20, 2018 @05:03PM
(#16888424)
oh, cool. thanks for the info.
Re:Show HN: Faster.js – a micro-optimizing JavaScript compiler
by sumnulu on Friday April 20, 2018 @02:52PM
(#16887496)
Incidentally, http://www.scala-js.org compiler has constant folding too.
Also if you need faster numeric calculations https://github.com/non/spire (has scala.js support)