-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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
[discussion] for loops: benchmarks for io.js wanted #1508
Comments
@hellboy81 these apply to all javascript runtimes.
|
Under very specific conditions it could theoretically be almost equally fast 😃 |
This jsperf (and its various revisions) has some interesting results regarding loop performance when visiting array elements (both destructive and not). |
The problem with including this sort of benchmark is that it depends on a variety of factors:
There's no one good answer aside from to benchmark your specific use case. If it comes down to choosing one form over another, in nearly all cases I would suggest avoiding basing the decision on the apparent performance differences, since they're subject to change due to optimizations in new versions of V8. That is to say, if you need to close over iterated values, use It's unlikely that we'll include a benchmark for various for-loop forms in this repository, since the data from such a benchmark could be misleading. If you're interested in these sorts of things, though, you might watch @trevnorris' esbench project, since I believe he's attempting collect that sort of perf information. |
The only benchmarks I found are not up-do-date
Should in
io.js
forArray
-s also be usedfor loop
instead offorEach
?The text was updated successfully, but these errors were encountered: