Skip to content

stream: speed up reads and iteration over default WHATWG streams#64320

Open
mcollina wants to merge 1 commit into
nodejs:mainfrom
mcollina:webstream-iterator-perf-round6
Open

stream: speed up reads and iteration over default WHATWG streams#64320
mcollina wants to merge 1 commit into
nodejs:mainfrom
mcollina:webstream-iterator-perf-round6

Conversation

@mcollina

@mcollina mcollina commented Jul 6, 2026

Copy link
Copy Markdown
Member

Skip the size algorithm call when it is the default one, and stop re-running the full ShouldCallPull predicate at per-chunk call sites where its inputs are already established.

readable-async-iterator type=normal: +16.6% (***)
readable-read-buffered: +13.9% to +27.5% (**/***)
pipe-to: +3.7% to +6.0% (15/16 configs significant)

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/performance

@nodejs-github-bot nodejs-github-bot added needs-ci PRs that need a full CI run. web streams labels Jul 6, 2026
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Skip the size algorithm call and its result validation when the size
algorithm is the default one, and stop re-running the full
ShouldCallPull predicate at per-chunk call sites where its inputs are
already established.

readable-async-iterator type=normal: +16.6% (***)
readable-read-buffered: +13.9% to +27.5% (**/***)
pipe-to: +3.7% to +6.0% (15/16 configs significant)

Signed-off-by: Matteo Collina <hello@matteocollina.com>
@mcollina mcollina force-pushed the webstream-iterator-perf-round6 branch from 31fb1fe to e16a18d Compare July 7, 2026 17:53
@codecov

codecov Bot commented Jul 7, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.25%. Comparing base (f4c85d5) to head (e16a18d).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #64320   +/-   ##
=======================================
  Coverage   90.24%   90.25%           
=======================================
  Files         741      741           
  Lines      240976   241022   +46     
  Branches    45408    45420   +12     
=======================================
+ Hits       217477   217536   +59     
+ Misses      15070    15054   -16     
- Partials     8429     8432    +3     
Files with missing lines Coverage Δ
lib/internal/webstreams/readablestream.js 98.18% <100.00%> (+0.02%) ⬆️

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

@mertcanaltin mertcanaltin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

lgtm

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. web streams

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants