Skip to content

Conversation

@avivkeller
Copy link
Member

Fixes #54603
Ref #50107

@nodejs-github-bot nodejs-github-bot added needs-ci PRs that need a full CI run. web streams labels Sep 21, 2024
@avivkeller avivkeller requested a review from H4ad September 21, 2024 16:35
@avivkeller avivkeller added the needs-benchmark-ci PR that need a benchmark CI run. label Sep 21, 2024
stream.constructor = ReadableStream;

return stream;
return ReflectConstruct(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
Member Author

@avivkeller avivkeller Sep 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
Member Author

@avivkeller avivkeller Sep 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

codecov bot 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 lines Coverage Δ
lib/internal/webstreams/readablestream.js 98.31% <100.00%> (-0.01%) ⬇️
lib/internal/webstreams/transformstream.js 99.56% <100.00%> (-0.01%) ⬇️
lib/internal/webstreams/writablestream.js 99.85% <100.00%> (-0.01%) ⬇️

... and 36 files with indirect coverage changes

@avivkeller avivkeller closed this Sep 22, 2024
@avivkeller
Copy link
Member Author

Superseded by #55067

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

Labels

needs-benchmark-ci PR that need a benchmark CI run. needs-ci PRs 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