Skip to content

diagnostics_channel: skip empty DisposableStack - #67836

Open
IlyasShabi wants to merge 1 commit into
nodejs:mainfrom
IlyasShabi:ishabi/dc-run-stores-fast-path
Open

IlyasShabi wants to merge 1 commit into
nodejs:mainfrom
IlyasShabi:ishabi/dc-run-stores-fast-path

Conversation

@IlyasShabi

Copy link
Copy Markdown
Member

This PR add a fast path when an active channel has subscribers but no bound stores. Returning early after activeChannel.publish(data) when !activeChannel._stores?.size avoids extra allocations on the subscriber hot path.

Local benchmark:

                                                                         confidence improvement accuracy (*)   (**)  (***)
tracing-channel-promise.js subscribers=1 context='omitted' n=10000000          ***     49.90 %       ±2.62% ±3.51% ±4.60%
tracing-channel-promise.js subscribers=1 context='provided' n=10000000         ***     59.97 %       ±1.83% ±2.44% ±3.18%
tracing-channel-promise.js subscribers=1 context='undefined' n=10000000        ***     49.35 %       ±1.96% ±2.62% ±3.44%
tracing-channel-sync.js subscribers=1 context='omitted' n=10000000             ***     87.70 %       ±4.65% ±6.26% ±8.27%
tracing-channel-sync.js subscribers=1 context='provided' n=10000000            ***    108.34 %       ±2.65% ±3.55% ±4.67%
tracing-channel-sync.js subscribers=1 context='undefined' n=10000000           ***     89.72 %       ±2.18% ±2.92% ±3.83%

Signed-off-by: ishabi <ilyasshabi94@gmail.com>
@nodejs-github-bot nodejs-github-bot added diagnostics_channel Issues and PRs related to the diagnostics_channel module. needs-ci PRs that need a full CI run. labels Nov 27, 2026
@IlyasShabi
IlyasShabi marked this pull request as ready for review November 27, 2026 21:28
@codecov

codecov Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.50%. Comparing base (1d069af) to head (61c3bf0).
⚠️ Report is 75 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #67836      +/-   ##
==========================================
- Coverage   90.51%   90.50%   -0.02%     
==========================================
  Files         805      805              
  Lines      285753   285881     +128     
  Branches    55165    55201      +36     
==========================================
+ Hits       258652   258726      +74     
- Misses      17192    17258      +66     
+ Partials     9909     9897      -12     
Files with missing lines Coverage Δ
lib/diagnostics_channel.js 97.96% <100.00%> (-0.29%) ⬇️

... and 69 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.

@IlyasShabi IlyasShabi added the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Nov 28, 2026
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Nov 28, 2026
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

diagnostics_channel Issues and PRs related to the diagnostics_channel module. needs-ci PRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants