http2: code style and performance improvements#16239
http2: code style and performance improvements#16239jasnell wants to merge 12 commits intonodejs:masterfrom
Conversation
mcollina
left a comment
There was a problem hiding this comment.
LGTM. how much do we gain by disabling the checks?
benchmark/http2/headers.js
Outdated
There was a problem hiding this comment.
Any specific reason --expose-http2 is back in? Is it just so compare can be run against versions where that was required?
There was a problem hiding this comment.
Yep. It's for benchmark comparisons against v8.x
About an extra ~1k reqs per second. With the checks and if-branches removed, I'm seeing a boost of about ~7k reqs per second with my limited benchmarking. |
|
Almost all of these checks are in hot paths btw |
|
@mcollina ... please take another look at this, in particular the last commit. All current tests are passing and performance is improved... we'll need to test this further tho. |
dcf716a to
5652326
Compare
No specific reason, and no specific preference, to be honest :-) |
|
@addaleax ... there... now using deque ;-) |
src/node_http2_core.h
Outdated
There was a problem hiding this comment.
These are supposed to check emptyness, right? That can still happen if we like.
There was a problem hiding this comment.
Yeah, but they're largely worthless checks. The Nghttp2Stream instances are pooled are only rarely actually destroyed so these checks aren't really helping us with much. I had them in there largely to test for correctness as I was writing the code.
|
The misbehaving flow control tests are failing on Windows so I'll need to get that checked out before this can land. |
|
|
Several if checks were left in while the code was being developed. Now that the core API has stablized more, the checks are largely unnecessary and can be removed, yielding a significant boost in performance.
8102281 to
9086258
Compare
apapirovski
left a comment
There was a problem hiding this comment.
Changes look good, confirming my approval.
PR-URL: #16239 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
* move CHECK statements into DEBUG checks
* improve performance by removing branches
* Several if checks were left in while the code was being developed.
Now that the core API has stablized more, the checks are largely
unnecessary and can be removed, yielding a significant boost in
performance.
* refactor flow control for proper backpressure
* use std::queue for inbound headers
* use std::queue for outbound data
* remove now unnecessary FreeHeaders function
* expand comments and miscellaneous edits
* add a couple of misbehaving flow control tests
PR-URL: #16239
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
|
Landed in 82b1660 and f16b9c1 |
PR-URL: #16239 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
* move CHECK statements into DEBUG checks
* improve performance by removing branches
* Several if checks were left in while the code was being developed.
Now that the core API has stablized more, the checks are largely
unnecessary and can be removed, yielding a significant boost in
performance.
* refactor flow control for proper backpressure
* use std::queue for inbound headers
* use std::queue for outbound data
* remove now unnecessary FreeHeaders function
* expand comments and miscellaneous edits
* add a couple of misbehaving flow control tests
PR-URL: #16239
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
PR-URL: nodejs/node#16239 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
* move CHECK statements into DEBUG checks
* improve performance by removing branches
* Several if checks were left in while the code was being developed.
Now that the core API has stablized more, the checks are largely
unnecessary and can be removed, yielding a significant boost in
performance.
* refactor flow control for proper backpressure
* use std::queue for inbound headers
* use std::queue for outbound data
* remove now unnecessary FreeHeaders function
* expand comments and miscellaneous edits
* add a couple of misbehaving flow control tests
PR-URL: nodejs/node#16239
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
PR-URL: nodejs/node#16239 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
* move CHECK statements into DEBUG checks
* improve performance by removing branches
* Several if checks were left in while the code was being developed.
Now that the core API has stablized more, the checks are largely
unnecessary and can be removed, yielding a significant boost in
performance.
* refactor flow control for proper backpressure
* use std::queue for inbound headers
* use std::queue for outbound data
* remove now unnecessary FreeHeaders function
* expand comments and miscellaneous edits
* add a couple of misbehaving flow control tests
PR-URL: nodejs/node#16239
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
A number of code style and performance improvements to the http2 internals.
A significant chunk of this involves removing some of the safety checks that were left in while things were being developed. Because the code has stablized, these are less necessary. Removing these yields a significant performance improvement.
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passesAffected core subsystem(s)
http2