Live data from Hacker News

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

github.com

1–10 of 37 posts

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

#6
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 can make debugging harder, etc)

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

#7
post #4

Prepack, https://prepack.io , is also in the same realm of an optimizing Javascript compiler.

Prepack is rather nice. It allows you to execute part of your code at compile time, like a macro.

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

#10
The demo page basically shows this is pointless practically - and sometimes _slower_.

These kind of optimizations were very useful in hot paths even just a few years ago. However browser engines have optimized functional patterns (what this mostly rewrites) to be within absolute microseconds of imperative versions.

In some cases it can even make useful assumptions in an FP method (immutability, etc) that it can't in the standard loops - which is why sometimes this is slower.

Long story short: concentrate on shipping less JavaScript and good practical solutions/algorithms and not stuff like this.

Post reply on HN