-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use for .. in
to iterate over arrays. NFC
#15094
Conversation
This seems to save some code size.. are there any downsides?
Of course once we get to |
This at least used to have worse performance in modern engines than a C-style for loop for arrays, since it has to check any properties and not just integer indices. Personally, I'd probably keep the old version. It might be useful to see how much this saves on practice (after gzip/brotli) on some real-world example, but I doubt it's much. |
OK sounds good. I'll close this for now. Would using |
I used to be a big fan of So to be safe, we should never use
Although yeah it's good to note that both |
I agree, same for various class constructs and object shorthands - we certainly have a bunch of places where those could help. |
Maybe we could enable those as part of the new |
I have a plan for how to enable ES6 across the codebase: #11984 . Basically I hope to enable ES6 by default and then force transpilation when users opt into older browser support. One key pointer is that we would like the default settings not to require transpilation which means the default broswer support settings need to have ES6 support (which I suspect they already do). |
Thanks, the plan in that issue looks solid, and I like the idea of just assuming that Wasm-supporting browsers have ES6 anyway. Btw, the stale bot just marked that issue as stale, you might want to bump it up (or resolve 😛). |
This seems to save some code size.. are there any downsides?