-
-
Notifications
You must be signed in to change notification settings - Fork 366
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
no-array-for-each Slower Performance #1522
Comments
You can disable it, if you prefer |
Sorry, accidentally closed it, I believe this is mistake made by #1149, this rule not mean to improve performance, but only readability. |
Micro-benchmarking code snippets like this is completely meaningless and does not reflect real-world performance. A "for-of" loop is faster, as it doesn't need to execute the body function for each iteration (it's just a scope). This especially matter if the loop body is complex. |
I went to https://jsbench.me/ and put in the following two tests...
Test 1:
Test 2:
The rule "no-array-for-each" is not better to use. The documentation indicates that using "for of" has better performance, but I dont believe it does. I may have better performance for straight arrays, but when it comes to Maps and Sets, I am finding better performance with using the built in "forEach()" method.
The text was updated successfully, but these errors were encountered: