stream: defer readable async iterator listener#63594
Closed
trivikr wants to merge 1 commit into
Closed
Conversation
Defer installing the readable listener for async iteration until read() returns null. This avoids listener dispatch on the common path where data is already buffered while preserving end-of-stream error handling. Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com> Assisted-by: openai:gpt-5.5
Collaborator
|
Review requested:
|
Contributor
|
Benchmark CI: https://ci.nodejs.org/view/Node.js%20benchmark/job/benchmark-node-micro-benchmarks/1853/ Results |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #63594 +/- ##
==========================================
- Coverage 90.32% 90.32% -0.01%
==========================================
Files 730 730
Lines 234653 234660 +7
Branches 43942 43947 +5
==========================================
+ Hits 211959 211961 +2
+ Misses 14415 14413 -2
- Partials 8279 8286 +7
🚀 New features to boost your workflow:
|
Contributor
|
There are significant perf regressions: and the CI did not reproduce the claimed perf improvements: |
Member
Author
|
Closing as the benchmark run locally was not reproducible in CI, and there were significant perf regressions in "streams/iter" throughput implementation. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This defers installing the
readablelistener for readable asynciteration until
read()returnsnull.The iterator still installs
eos()up front, so existing error and closehandling is preserved. For the common path where chunks are already
buffered, this avoids listener dispatch while the iterator drains data.
Benchmark results are neutral-to-positive, with no statistically
significant regression observed:
Assisted-by: openai:gpt-5.5