Skip to content

dgram: improve get-send-queue-info performance #59054

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

IlyasShabi
Copy link
Contributor

Improve dgram getSendQueueSize and getSendQueueCount performance by using V8 fast API.

Local benchmark:

                                                      confidence improvement accuracy (*)   (**)  (***)
dgram/get-send-queue-info.js method='count' n=5000000        ***    127.63 %       ±1.01% ±1.35% ±1.77%
dgram/get-send-queue-info.js method='size' n=5000000         ***    127.77 %       ±2.18% ±2.92% ±3.86%

@nodejs-github-bot
Copy link
Collaborator

Review requested:

  • @nodejs/net
  • @nodejs/performance

@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. dgram Issues and PRs related to the dgram subsystem / UDP. needs-ci PRs that need a full CI run. labels Jul 13, 2025
@IlyasShabi IlyasShabi marked this pull request as ready for review July 13, 2025 22:32
Copy link

codecov bot commented Jul 13, 2025

Codecov Report

Attention: Patch coverage is 47.82609% with 12 lines in your changes missing coverage. Please review.

Project coverage is 90.05%. Comparing base (09b4c57) to head (0f7af8e).
Report is 24 commits behind head on main.

Files with missing lines Patch % Lines
src/udp_wrap.cc 47.82% 12 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #59054      +/-   ##
==========================================
- Coverage   90.07%   90.05%   -0.03%     
==========================================
  Files         641      645       +4     
  Lines      188998   189150     +152     
  Branches    37069    37093      +24     
==========================================
+ Hits       170246   170345      +99     
- Misses      11462    11521      +59     
+ Partials     7290     7284       -6     
Files with missing lines Coverage Δ
src/udp_wrap.h 100.00% <ø> (ø)
src/udp_wrap.cc 76.86% <47.82%> (-1.43%) ⬇️

... and 48 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

bench.start();

if (method === 'size') {
for (let i = 0; i < n; ++i) server.getSendQueueSize();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think at some point this will be JIT-eliminated

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that getSendQueueSize() will not be JIT eliminated because it still calls into libuv. Im using size and count now to accumulate the results in order to make that explicit

@nodejs-github-bot
Copy link
Collaborator

Copy link
Member

@RafaelGSS RafaelGSS left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nevermind, I was looking to HEAD.

@RafaelGSS RafaelGSS added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Jul 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author ready PRs that have at least one approval, no pending requests for changes, and a CI started. c++ Issues and PRs that require attention from people who are familiar with C++. dgram Issues and PRs related to the dgram subsystem / UDP. needs-ci PRs that need a full CI run.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants