During JavaScript code refactoring in my project I\'ve found that some of my loops slowed down drastically. Searching for root cause I\'ve found this SO question stating slo
I can answer the V8 part of the question. The slowdown you're seeing is due to a limitation in the old optimizing compiler (known as "Crankshaft"). It hasn't been addressed in all this time because the team has been busy working on the new optimizing compiler ("Turbofan"), which is shipping in Chrome 59 (currently on the Canary and Dev channels, soon on Beta!).
In Chrome 58 (currently on Beta), you can already get a preview by setting the "Experimental JavaScript Compilation Pipeline" to "Enabled" (at chrome://flags/#enable-v8-future
). Note that Chrome 59 will have a couple of additional performance improvements.
Side note: in an existing codebase, there isn't much benefit in migrating to let
, so you could just keep using var
.