Live data from Hacker News

Show HN: Faster.js – a micro-optimizing JavaScript compiler

github.com

31–37 of 37 posts

Re: Show HN: Faster.js – a micro-optimizing JavaScript compiler

#31
post #30

Their first example for (let _i = 0; _i This is recalculating length on each iteration

The mystery of JIT optimization. The optimizer will turn that into a dereferenced register value. I remember reading that v8 used to add an extra instruction if you assigned the variable yourself.

Re: Show HN: Faster.js – a micro-optimizing JavaScript compiler

#32

This is cool, but array methods are so rarely the bottleneck; Even in the highly-specialized demo, the difference is near-negligible. It's a fun project and might have application in specialized situations (and maybe for Node, where time spent in synchronous iteration blocks all other requests?). But I feel like this does more harm than good in most cases (larger bundle, extra build step, less readable output code ca…

It’s seems like it does harm in JS environments that have JITs. But it would be interesting in strictly interpreted environments. Some devices run JS but disallow JIT due to security concerns.

Re: Show HN: Faster.js – a micro-optimizing JavaScript compiler

#33
post #7

Earlier quoted context omitted.

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);

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).

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.

Post reply on HN