Skip to content

Conversation

@avivkeller
Copy link
Member

Fixes#54603
Ref #50107

@nodejs-github-botnodejs-github-bot added needs-ci PRs that need a full CI run. web streams labels Sep 21, 2024
@avivkelleravivkeller added the needs-benchmark-ci PR that need a benchmark CI run. label Sep 21, 2024
stream.constructor=ReadableStream;

returnstream;
returnReflectConstruct(function(){
Copy link
Member

Choose a reason for hiding this comment

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

ReflectConstruct is extremely slow.

Copy link
MemberAuthor

@avivkelleravivkellerSep 21, 2024

Choose a reason for hiding this comment

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

I'm aware, is there another way to make this WPT compliant? We need a way to have the prototype of the transferred stream === the original prototype.

Copy link
MemberAuthor

@avivkelleravivkellerSep 21, 2024

Choose a reason for hiding this comment

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

FWIW regarding speed, this has around a -20% on speed, so not good. Is there a reason we can't just return ReadableStream as is?

Copy link
Contributor

Choose a reason for hiding this comment

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

Deno solves this by adding a special overload to their ReadableStream constructor, which essentially skips the regular steps. Maybe we should do something similar?

@codecov
Copy link

codecovbot commented Sep 21, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.22%. Comparing base (5116578) to head (fe71574).
Report is 20 commits behind head on main.

Additional details and impacted files
@@ Coverage Diff @@## main #55047 +/- ## ========================================== - Coverage 88.24% 88.22% -0.02%  ========================================== Files 652 652 Lines 183886 183867 -19 Branches 35855 35859 +4 ========================================== - Hits 162263 162221 -42 - Misses 14902 14919 +17 - Partials 6721 6727 +6 
Files with missing linesCoverage Δ
lib/internal/webstreams/readablestream.js98.31% <100.00%> (-0.01%)⬇️
lib/internal/webstreams/transformstream.js99.56% <100.00%> (-0.01%)⬇️
lib/internal/webstreams/writablestream.js99.85% <100.00%> (-0.01%)⬇️

... and 36 files with indirect coverage changes

@avivkeller
Copy link
MemberAuthor

Superseded by #55067

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

Labels

needs-benchmark-ciPR that need a benchmark CI run.needs-ciPRs that need a full CI run.web streams

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Node.js structuredClone objects do not preserve prototypes

4 participants

@avivkeller@MattiasBuelens@anonrig@nodejs-github-bot