| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
|
Review requested:
|
Sorry, something went wrong.
Codecov Report❌ Patch coverage is 86.27451% with 7 lines in your changes missing coverage. Please review.
@@ Coverage Diff @@
## main #65296 +/- ##
==========================================
- Coverage 90.30% 90.12% -0.19%
==========================================
Files 759 752 -7
Lines 248294 251826 +3532
Branches 46860 47356 +496
==========================================
+ Hits 224220 226954 +2734
- Misses 15516 16225 +709
- Partials 8558 8647 +89
... and 174 files with indirect coverage changes 🚀 New features to boost your workflow:
|
Sorry, something went wrong.
There was a problem hiding this comment.
Have you benchmarked against an unordered_set or just a plain vector?
I suspect those would be more cache friendly and avoid pointer chasing.
Sorry, something went wrong.
Commit Queue failed- Loading data for nodejs/node/pull/65296 ✔ Done loading data for nodejs/node/pull/65296 ----------------------------------- PR info ------------------------------------ Title http: use intrusive lists in ConnectionsList (#65296) Author Matteo Collina <matteo.collina@gmail.com> (@mcollina) Branch mcollina:http-connectionslist-intrusive -> nodejs:main Labels c++, http_parser, author ready, needs-ci, commit-queue Commits 1 - http: use intrusive lists in ConnectionsList Committers 1 - Matteo Collina <hello@matteocollina.com> PR-URL: https://github.com/nodejs/node/pull/65296 Reviewed-By: Robert Nagy <ronagy@icloud.com> Reviewed-By: Paolo Insogna <paolo@cowtech.it> ------------------------------ Generated metadata ------------------------------ PR-URL: https://github.com/nodejs/node/pull/65296 Reviewed-By: Robert Nagy <ronagy@icloud.com> Reviewed-By: Paolo Insogna <paolo@cowtech.it> -------------------------------------------------------------------------------- ℹ This PR was created on Sat, 15 Aug 2026 04:05:15 GMT ✔ Approvals: 2 ✔ - Robert Nagy (@ronag) (TSC): https://github.com/nodejs/node/pull/65296#pullrequestreview-4943029706 ✔ - Paolo Insogna (@ShogunPanda) (TSC): https://github.com/nodejs/node/pull/65296#pullrequestreview-4949195971 ✘ 3 GitHub CI job(s) failed: ✘ - format-cpp: FAILURE (https://github.com/nodejs/node/actions/runs/31863623606/job/94961040997) ✘ - lint-commit-message: FAILURE (https://github.com/nodejs/node/actions/runs/31863623617/job/94961006361) ✘ - test-macOS: FAILURE (https://github.com/nodejs/node/actions/runs/31863623630/job/94961038864) ℹ Last Full PR CI on 2026-08-16T15:24:03Z: https://ci.nodejs.org/job/node-test-pull-request/75886/ - Querying data for job/node-test-pull-request/75886/ ✔ Build data downloaded - Querying failures of job/node-test-commit/90616/ ✔ Data downloaded ✘ 2 failure(s) on the last Jenkins CI run -------------------------------------------------------------------------------- ✔ Aborted `git node land` session in /home/runner/work/node/node/.ncuhttps://github.com/nodejs/node/actions/runs/32009841931 |
Sorry, something went wrong.
Every HTTP message was performing multiple erase and insert operations on two std::set instances ordered by a mutating key, showing up as ~2% of CPU cycles in a hello-world server profile due to red-black tree rebalancing and node allocations. Replace both sets with intrusive doubly-linked lists. Membership in the list of all connections no longer changes per message, and updating the active connections list is now O(1) with no allocations. Appending to the tail keeps the active list ordered by last_message_start_ because uv_hrtime() is monotonic. Signed-off-by: Matteo Collina <hello@matteocollina.com>
Commit Queue failed- Loading data for nodejs/node/pull/65296 ✔ Done loading data for nodejs/node/pull/65296 ----------------------------------- PR info ------------------------------------ Title http: use intrusive lists in ConnectionsList (#65296) Author Matteo Collina <matteo.collina@gmail.com> (@mcollina) Branch mcollina:http-connectionslist-intrusive -> nodejs:main Labels c++, http_parser, author ready, needs-ci, commit-queue Commits 1 - http: use intrusive lists in ConnectionsList Committers 1 - Matteo Collina <hello@matteocollina.com> PR-URL: https://github.com/nodejs/node/pull/65296 Reviewed-By: Robert Nagy <ronagy@icloud.com> Reviewed-By: Paolo Insogna <paolo@cowtech.it> Reviewed-By: James M Snell <jasnell@gmail.com> ------------------------------ Generated metadata ------------------------------ PR-URL: https://github.com/nodejs/node/pull/65296 Reviewed-By: Robert Nagy <ronagy@icloud.com> Reviewed-By: Paolo Insogna <paolo@cowtech.it> Reviewed-By: James M Snell <jasnell@gmail.com> -------------------------------------------------------------------------------- ℹ This PR was created on Sat, 15 Aug 2026 04:05:15 GMT ✔ Approvals: 3 ✔ - Robert Nagy (@ronag) (TSC): https://github.com/nodejs/node/pull/65296#pullrequestreview-4943029706 ✔ - Paolo Insogna (@ShogunPanda) (TSC): https://github.com/nodejs/node/pull/65296#pullrequestreview-4969028193 ✔ - James M Snell (@jasnell) (TSC): https://github.com/nodejs/node/pull/65296#pullrequestreview-4951932271 ✔ Last GitHub CI successful ℹ Last Full PR CI on 2026-08-17T08:31:16Z: https://ci.nodejs.org/job/node-test-pull-request/75919/ ⚠ Commits were pushed after the last Full PR CI run: ⚠ - http: use intrusive lists in ConnectionsList - Querying data for job/node-test-pull-request/75919/ ✔ Build data downloaded ✔ Last Jenkins CI successful -------------------------------------------------------------------------------- ✔ Aborted `git node land` session in /home/runner/work/node/node/.ncuhttps://github.com/nodejs/node/actions/runs/32254812825 |
Sorry, something went wrong.
Sorry, something went wrong.
Every HTTP message was performing multiple erase and insert operations on two std::set instances ordered by a mutating key, showing up as ~2% of CPU cycles in a hello-world server profile due to red-black tree rebalancing and node allocations. Replace both sets with intrusive doubly-linked lists. Membership in the list of all connections no longer changes per message, and updating the active connections list is now O(1) with no allocations. Appending to the tail keeps the active list ordered by last_message_start_ because uv_hrtime() is monotonic. Signed-off-by: Matteo Collina <hello@matteocollina.com> PR-URL: #65296 Reviewed-By: Robert Nagy <ronagy@icloud.com> Reviewed-By: Paolo Insogna <paolo@cowtech.it> Reviewed-By: James M Snell <jasnell@gmail.com>
Every HTTP message was performing multiple erase and insert operations on two std::set instances ordered by a mutating key, showing up as ~2% of CPU cycles in a hello-world server profile due to red-black tree rebalancing and node allocations. Replace both sets with intrusive doubly-linked lists. Membership in the list of all connections no longer changes per message, and updating the active connections list is now O(1) with no allocations. Appending to the tail keeps the active list ordered by last_message_start_ because uv_hrtime() is monotonic. Signed-off-by: Matteo Collina <hello@matteocollina.com> PR-URL: #65296 Reviewed-By: Robert Nagy <ronagy@icloud.com> Reviewed-By: Paolo Insogna <paolo@cowtech.it> Reviewed-By: James M Snell <jasnell@gmail.com>
| Back | FazBrowse Home | New Git URL |
Every HTTP message was performing multiple erase and insert operations on the two std::set instances in ConnectionsList, which are ordered by a key (last_message_start_) that mutates on every message. In a hello-world server profile this showed up as ~2.2% of total CPU cycles spent in red-black tree rebalancing plus tree-node allocations, all on the per-request hot path.
This PR replaces both sets with intrusive doubly-linked lists:
Benchmark results (Linux, i7-7700, server and benchmarker pinned to separate cores):
A separate interleaved wrk A/B (hello-world server, -t2 -c50, 5 alternating pairs) shows +4.9% (26,599 → 27,914 req/s), with the patched binary winning every pair. A perf profile of the patched binary confirms the _Rb_tree symbols are gone and malloc traffic in the parser path is roughly halved.
This PR was prepared with the help of AI assistance.