for-of, forEach, and the classic for loops are now equally fast in V8 - @mathias at #jsconfau18
Yaihh for inlining in forEach!!!
-
-
Replying to @cramforce @mathias
Does that also mean map is as fast as using for loop?
1 reply 0 retweets 0 likes -
Replying to @EmmiePaivarinta @cramforce
In general, yes. Whenever it makes sense to use `map` in your code, please go ahead and do so. We’ll make it fast for you, and other JS engines can do the same.
1 reply 1 retweet 2 likes -
Replying to @mathias @cramforce
That's great, I prefer writing readable code anyway
It seems like there are so many old JS performance myths around. In doubt profiling is the only right tool, not relying on micro-optimizations from hearsay, right?
1 reply 0 retweets 0 likes
Definitely! Lots of micro-performance tips from 5 years ago are no longer valid today because JS engines evolve so quickly. The best way to deal with it is to just write sensible, idiomatic code using modern language features, and to let JS engines worry about making it fast.
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.
JavaScript, HTML, CSS, HTTP, performance, security, Bash, Unicode, i18n, macOS.