Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 34.3k
http2: improve http2 code a bit#23984
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
Uh oh!
There was an error while loading. Please reload this page.
Conversation
nodejs-github-bot commented Oct 30, 2018
Multiple general improvements to http2 internals for readability and efficiency
9c996f2 to d408b51Comparejasnell commented Nov 1, 2018
jasnell commented Nov 2, 2018
ping @nodejs/http2 |
mcollina left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Are there any performance benefits?
Trott commented Nov 4, 2018
Landed in 7825045 |
Multiple general improvements to http2 internals for readability and efficiency PR-URL: nodejs#23984 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]> Reviewed-By: Ujjwal Sharma <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
Multiple general improvements to http2 internals for readability and efficiency PR-URL: #23984 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]> Reviewed-By: Ujjwal Sharma <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
GrosSacASac commented Nov 6, 2018
From https://github.com/nodejs/node/blob/7825045ee695e9e5c048133255a3b614e04c98d3/lib/internal/http2/util.js it would replace constkeys=Object.keys(map);leti;letkey;letvalue;for(i=0;i<keys.length;i++){key=keys[i];value=map[key];}with something like Object.entries(map).forEach(([key,value])=>{}); |
GrosSacASac commented Nov 6, 2018
node/lib/internal/http2/util.js Line 486 in 7825045
Is it a good idea to push into an array, and join all the strings at the end, instead of doing string concatenation each time in the loop ? |
jasnell commented Nov 6, 2018 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
Using entries and forEach is quite a bit more expensive performance wise, as is join, because it forces additional unnecessary iterations over the values. |
GrosSacASac commented Nov 6, 2018
What is the meaning of irritations in this context ? |
jasnell commented Nov 6, 2018
Sorry, that was a phone autocorrect error... Lol I meant additional unnecessary iterations 😂 |
GrosSacASac commented Nov 7, 2018
The most natural way to write a program should result in top-of-the-line runtime performance. In places where performance is king, the optimal code should be clearly expressible. Should we open issue in the engine ? |
jasnell commented Nov 7, 2018
The v8 team is continually making improvements to the performance in this area, and I suspect they will continue to do so. We'll get there eventually. |
codebytere commented Nov 29, 2018
@jasnell do you want to potentially backport this? |
jasnell commented Nov 29, 2018 via email
Yeah, we should …On Wed, Nov 28, 2018, 18:59 Shelley Vohr ***@***.*** wrote: @jasnell <https://github.com/jasnell> do you want to potentially backport this? — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub <#23984 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AAa2ebmROWc4uqrmlFd-msYrR2w0rHT5ks5uz02sgaJpZM4YDDzo> . |
codebytere commented Nov 29, 2018
@jasnell do you have the bandwidth for this atm? |
jasnell commented Nov 29, 2018
Not so much. Will take a few weeks for me to get to it |
Multiple general improvements to http2 internals for readability and efficiency [This backport applied to v10.x cleanly.] Backport-PR-URL: #29123 PR-URL: #23984 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]> Reviewed-By: Ujjwal Sharma <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
Multiple general improvements to http2 internals for readability and efficiency [This backport applied to v10.x cleanly but had several merge conflicts on v8.x.] PR-URL: #23984 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]> Reviewed-By: Ujjwal Sharma <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
Multiple general improvements to http2 internals for readability and efficiency
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passes