Skip to content

stream: keep consumer state in fast mode - #66266

Open
mcollina wants to merge 1 commit into
nodejs:mainfrom
mcollina:stream/fast-share-broadcast-state
Open

mcollina wants to merge 1 commit into
nodejs:mainfrom
mcollina:stream/fast-share-broadcast-state

Conversation

@mcollina

Copy link
Copy Markdown
Member

Create null-prototype share and broadcast consumer state with fast
properties instead of V8 dictionary properties.

Assisted-by: Pi

Create null-prototype share and broadcast consumer state with fast
   properties instead of V8 dictionary properties.

Assisted-by: Pi
Signed-off-by: Matteo Collina <hello@matteocollina.com>
@mcollina
mcollina requested a review from jasnell September 24, 2026 21:36
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/performance
  • @nodejs/streams

@nodejs-github-bot nodejs-github-bot added needs-ci PRs that need a full CI run. stream Issues and PRs related to Node.js streams. labels Sep 24, 2026
@codecov

codecov Bot commented Sep 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.30%. Comparing base (e7d8ab5) to head (350436a).
⚠️ Report is 12 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #66266   +/-   ##
=======================================
  Coverage   90.30%   90.30%           
=======================================
  Files         789      789           
  Lines      272880   272879    -1     
  Branches    52110    52109    -1     
=======================================
  Hits       246418   246418           
- Misses      16912    16921    +9     
+ Partials     9550     9540   -10     
Files with missing lines Coverage Δ
lib/internal/streams/iter/broadcast.js 90.50% <100.00%> (ø)
lib/internal/streams/iter/share.js 89.30% <100.00%> (-0.02%) ⬇️

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

@mcollina

Copy link
Copy Markdown
Member Author

Benchmarks:

Benchmark Consumers Before After Change
streams/iter-throughput-share 2 121,268 123,878 +2.2%
streams/iter-throughput-share 8 193,168 200,535 +3.8%
streams/iter-throughput-share 32 213,996 217,894 +1.8%
streams/iter-throughput-share-sync 2 776,705 839,246 +8.1%
streams/iter-throughput-share-sync 8 1,773,686 1,831,000 +3.2%
streams/iter-throughput-share-sync 32 2,497,892 2,923,947 +17.1%
streams/iter-throughput-broadcast 2 10,637 10,832 +1.8%
streams/iter-throughput-broadcast 4 8,415 8,654 +2.8%

Share used batches=10000 n=5 backpressure=unbounded; sync share used batches=10000 n=5; broadcast used api=iter datasize=1048576 n=500. The broadcast results are noisy, so I would not treat those small differences as conclusive.

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

Labels

needs-ci PRs that need a full CI run. stream Issues and PRs related to Node.js streams.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants