Uh oh!
There was an error while loading. Please reload this page.
events: improve for-loop - #26354
Closed
gengjiawen wants to merge 1 commit into
Closed
Conversation
BridgeAR
approved these changes
Feb 28, 2019
BethGriggs
approved these changes
Feb 28, 2019
Member
Is |
MemberAuthor
When test count is small ( When test count is bigger ( Env: System: OS: macOS 10.14.3 CPU: (8) x64 Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz Memory: 1.27 GB / 16.00 GB Shell: 3.0.0 - /usr/local/bin/fish Binaries: Node: 11.10.1 - /usr/local/bin/node Yarn: 1.13.0 - /usr/local/bin/yarn npm: 6.7.0 - /usr/local/bin/npmTest snippet constTEST_COUNT=Math.pow(10,2);constpojo={name: 'n',age: 10}functionBenckmark(desc,func){console.time(desc)letsum=0;for(letindex=0;index<TEST_COUNT;index++){func()}console.timeEnd(desc)}constnoop=()=>{}functionforLoop(o){constkeys=Object.keys(o)for(leti=0;i<keys.length;++i){constkey=keys[i]noop(key)}}functionforOf(o){for(constkeyofObject.keys(o)){noop(key)}}Benckmark('forLoop',()=>forLoop(pojo))Benckmark('forOf',()=>forOf(pojo)) |
BridgeAR
commented
Mar 1, 2019
Member
@gengjiawen turning around the execution order is also going to turn around the results for what is faster for big The difference between the two loops is not very big but it is ~15%. See https://bugs.chromium.org/p/v8/issues/detail?id=8070 for the tracking bug that I opened last year for it. |
BridgeAR
commented
Mar 4, 2019
Member
BridgeAR pushed a commit
to BridgeAR/node
that referenced
this pull request
Mar 5, 2019
PR-URL: nodejs#26354 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Beth Griggs <Bethany.Griggs@uk.ibm.com>
BridgeAR
commented
Mar 5, 2019
Member
Landed in d79176a 🎉 |
BridgeAR pushed a commit
to BridgeAR/node
that referenced
this pull request
Mar 12, 2019
PR-URL: nodejs#26354 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Beth Griggs <Bethany.Griggs@uk.ibm.com>
BethGriggs pushed a commit
that referenced
this pull request
Apr 16, 2019
PR-URL: #26354 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Beth Griggs <Bethany.Griggs@uk.ibm.com>
Merged
This was referenced May 29, 2019
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passes