stream: fast path single-destination pipe#63592
Conversation
Avoid EventEmitter dispatch for the readable pipe data handler when it is the only data listener. Fall back to normal data event emission when additional data listeners are present to preserve listener ordering. Signed-off-by: Kamat, Trivikram <[email protected]> Assisted-by: openai:gpt-5.5
|
Review requested:
|
ronag
left a comment
There was a problem hiding this comment.
This looks to me like it will break stuff. What happens if a data listener is added after pipe? Can you add a test for that.
If a
Added a test in The added test starts with |
2d523a1 to
3184889
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #63592 +/- ##
=======================================
Coverage 90.32% 90.32%
=======================================
Files 730 730
Lines 234653 234666 +13
Branches 43942 43943 +1
=======================================
+ Hits 211959 211973 +14
+ Misses 14415 14411 -4
- Partials 8279 8282 +3
🚀 New features to boost your workflow:
|
Avoid EventEmitter dispatch for the internal
readable.pipe()data handlerwhen it is the only
datalistener on the source stream.If any additional
datalistener is present, the stream falls back to normaldataevent emission so listener ordering is preserved.Benchmark:
Assisted-by: openai:gpt-5.5