3 ms·
It seems crazy to me that performance takes a backseat to syntactical sugar, which is most of what ES6 provides. There are a few new constructs, but in my mind
by iamleppert 11y ago
It seems crazy to me that performance takes a backseat to syntactical sugar, which is most of what ES6 provides. There are a few new constructs, but in my mind when is it ever acceptable to have performance regressions to make the code look pretty?
And the fact that it isn't optional is alarming. If you use the new features, you should have to suffer performance penalty if there is one, and at least be able to make that design choice and trade-off between "cleaner" or "prettier" code and poor performance.
I don't think you can call something "complete" or green until the performance issue is solved.
- tracker1 11y agoIt's better to make something that works, and then improve performance as-needed than to try and optimize before hand. You don't always know the real world impact of a given solution until you have one, and synthetic tests aren't a reflection of real world impact. Beyond this, I happen to like a lot of the sugar. It makes code simpler, cleaner and in most cases easier to comprehend... Sometimes the fat arrow functions returning fat arrow functions gets a little weird, but outside of that, it's a pretty big benefit. Async functions will help a lot as well once they land, for now, Babel works well enough.
- _greim_ 11y agoIt isn't that this new syntax is slow, so much as V8 has a shit-ton of internal machinery dedicated to optimizing specific execution paths, and it is those things which get a massive efficiency boost. In that sense, becoming syntax complete is just a first step down a very long road.
- s3th 11y agoSee my comment below: https://news.ycombinator.com/item?id=11564354 https://news.ycombinator.com/item?id=11564354 It's not so simple as (paraphrasing) 'ES6 is sugar and makes ES5 regress in speed.' Generally, "make it work right, then make it work fast" is actually a pretty good strategy for implementing new features.