Re:JS MythBusters – An optimization handbook from a high lev...
by mintplant on Tuesday August 30, 2016 @04:34PM
(#12393642)
I'm extremely skeptical of that claim, too. As far as I can tell SpiderMonkey for example will emit practically exactly the same code for >= and <= as other comparisons. In loop optimization SpiderMonkey will actually sometimes rewrite eg. `x < y` as `x + 1 <= y` to put linear inequalities into a standard form for analysis [0].
They also recommend using `let` and `const` over `var` for performance reasons in the "Scope" section, but I have to ask whether they benchmarked that at all. Engines may grow to take advantage of these signals over time for further optimization, but at the moment many ES6 features incur a performance penalty just because the code behind them is less mature. I don't know specifically about `let`/`const` but I'd be pleasantly surprised to learn that they boost performance anywhere yet.
They also recommend using `let` and `const` over `var` for performance reasons in the "Scope" section, but I have to ask whether they benchmarked that at all. Engines may grow to take advantage of these signals over time for further optimization, but at the moment many ES6 features incur a performance penalty just because the code behind them is less mature. I don't know specifically about `let`/`const` but I'd be pleasantly surprised to learn that they boost performance anywhere yet.
[0] https://dxr.mozilla.org/mozilla-central/source/js/src/jit/Io...