stream: improve ReadableStream.tee perf by remove ReflectConstruct usage#49546
Conversation
also added more webstream creation benchmarks
| // For spec compliance the Tee must be a ReadableStream | ||
| tee.constructor = ReadableStream; |
There was a problem hiding this comment.
Otherwise, the wpt tee test fails:
node/test/fixtures/wpt/streams/readable-streams/tee.any.js
Lines 8 to 18 in 6dde810
And the spec says
Tees this readable stream, returning a two-element array containing the two resulting branches as new ReadableStream instances.
From the Spec
anonrig
left a comment
There was a problem hiding this comment.
You beat me to it. Good work!
| [SymbolToStringTag]: getNonWritablePropertyDescriptor(ReadableByteStreamController.name), | ||
| }); | ||
|
|
||
| function TeeReadableStream(start, pull, cancel) { |
There was a problem hiding this comment.
is there a reason this can't be a normal class? Would help with the inheritance/prototype hacks needed
There was a problem hiding this comment.
I'll have to call super and the original implementation don't call the constructor
There was a problem hiding this comment.
I think it would simplify the code significantly, not blocking or anything
There was a problem hiding this comment.
so you mean to just convert it to class with extends but without super?
when I do the WPT tests fails so keeping it as is
|
Landed in a7fe8b0 |
also added more webstream creation benchmarks PR-URL: nodejs#49546 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
also added more webstream creation benchmarks PR-URL: nodejs#49546 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
also added more webstream creation benchmarks PR-URL: nodejs#49546 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
also added more webstream creation benchmarks
My local benchmark shows improvement of 2 times:
After:
Benchmark CI output: