Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Flight] Make byteLengthOfChunk Optional #30130

Merged
merged 2 commits into from
Jun 28, 2024

Conversation

sebmarkbage
Copy link
Collaborator

@sebmarkbage sebmarkbage commented Jun 28, 2024

We use this to encode the binary length of a large string without escaping it. This is really kind of optional though. This lets a Server that can't encode strings but just pass them along able to emit RSC - albeit a less optimal format.

The only build we have that does that today is react-html but the FB version of Flight had a similar constraint.

It's still possible to support binary data as long as byteLengthOfBinaryChunk is implemented which doesn't require a text encoder. Many streams (including Node streams) support binary OR string chunks.

@sebmarkbage sebmarkbage requested a review from eps1lon June 28, 2024 15:25
Copy link

vercel bot commented Jun 28, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
react-compiler-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 28, 2024 3:29pm

Currently they are outlined with byte length.
This lets a server that can't encode strings but just pass them along able
to emit RSC - albeit a less optimal format.

The only build we have that does that today is react-html but the FB
version of Flight had a similar constraint.

It's still possible to support binary data as long as byteLengthOfBinaryChunk
is implemented which doesn't require a text encoder.
@react-sizebot
Copy link

Comparing: 58af67a...1285d5c

Critical size changes

Includes critical production bundles, as well as any change greater than 2%:

Name +/- Base Current +/- gzip Base gzip Current gzip
oss-stable/react-dom/cjs/react-dom.production.js = 6.68 kB 6.68 kB = 1.83 kB 1.83 kB
oss-stable/react-dom/cjs/react-dom-client.production.js = 497.99 kB 497.99 kB = 89.27 kB 89.27 kB
oss-experimental/react-dom/cjs/react-dom.production.js = 6.69 kB 6.69 kB = 1.83 kB 1.83 kB
oss-experimental/react-dom/cjs/react-dom-client.production.js = 502.81 kB 502.81 kB = 89.97 kB 89.97 kB
facebook-www/ReactDOM-prod.classic.js = 597.08 kB 597.08 kB = 105.33 kB 105.33 kB
facebook-www/ReactDOM-prod.modern.js = 571.42 kB 571.42 kB = 101.27 kB 101.27 kB
test_utils/ReactAllWarnings.js Deleted 62.88 kB 0.00 kB Deleted 15.69 kB 0.00 kB

Significant size changes

Includes any change greater than 0.2%:

Expand to show
Name +/- Base Current +/- gzip Base gzip Current gzip
oss-stable-rc/react-server/cjs/react-server-flight.production.js +0.40% 55.17 kB 55.39 kB +0.57% 11.14 kB 11.21 kB
oss-stable-semver/react-server/cjs/react-server-flight.production.js +0.40% 55.17 kB 55.39 kB +0.57% 11.14 kB 11.21 kB
oss-stable/react-server/cjs/react-server-flight.production.js +0.40% 55.17 kB 55.39 kB +0.57% 11.14 kB 11.21 kB
oss-experimental/react-server/cjs/react-server-flight.production.js +0.38% 59.13 kB 59.35 kB +0.58% 11.86 kB 11.93 kB
oss-stable-rc/react-server-dom-esm/cjs/react-server-dom-esm-server.node.production.js +0.33% 86.13 kB 86.41 kB +0.48% 17.97 kB 18.06 kB
oss-stable-semver/react-server-dom-esm/cjs/react-server-dom-esm-server.node.production.js +0.33% 86.13 kB 86.41 kB +0.48% 17.97 kB 18.06 kB
oss-stable/react-server-dom-esm/cjs/react-server-dom-esm-server.node.production.js +0.33% 86.13 kB 86.41 kB +0.48% 17.97 kB 18.06 kB
oss-experimental/react-server-dom-esm/cjs/react-server-dom-esm-server.node.production.js +0.32% 89.75 kB 90.04 kB +0.44% 18.63 kB 18.71 kB
oss-stable-rc/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.browser.production.js +0.31% 89.25 kB 89.53 kB +0.47% 18.39 kB 18.47 kB
oss-stable-semver/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.browser.production.js +0.31% 89.25 kB 89.53 kB +0.47% 18.39 kB 18.47 kB
oss-stable/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.browser.production.js +0.31% 89.25 kB 89.53 kB +0.47% 18.39 kB 18.47 kB
oss-stable-rc/react-server-dom-webpack/cjs/react-server-dom-webpack-server.browser.production.js +0.31% 89.57 kB 89.85 kB +0.46% 18.48 kB 18.57 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-server.browser.production.js +0.31% 89.57 kB 89.85 kB +0.46% 18.48 kB 18.57 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-server.browser.production.js +0.31% 89.57 kB 89.85 kB +0.46% 18.48 kB 18.57 kB
oss-stable-rc/react-server-dom-webpack/cjs/react-server-dom-webpack-server.edge.production.js +0.31% 89.59 kB 89.87 kB +0.46% 18.50 kB 18.59 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-server.edge.production.js +0.31% 89.59 kB 89.87 kB +0.46% 18.50 kB 18.59 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-server.edge.production.js +0.31% 89.59 kB 89.87 kB +0.46% 18.50 kB 18.59 kB
oss-stable-rc/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.edge.production.js +0.31% 89.61 kB 89.89 kB +0.46% 18.50 kB 18.58 kB
oss-stable-semver/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.edge.production.js +0.31% 89.61 kB 89.89 kB +0.46% 18.50 kB 18.58 kB
oss-stable/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.edge.production.js +0.31% 89.61 kB 89.89 kB +0.46% 18.50 kB 18.58 kB
oss-stable-rc/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.unbundled.production.js +0.31% 91.78 kB 92.07 kB +0.47% 18.86 kB 18.95 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.unbundled.production.js +0.31% 91.78 kB 92.07 kB +0.47% 18.86 kB 18.95 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.unbundled.production.js +0.31% 91.78 kB 92.07 kB +0.47% 18.86 kB 18.95 kB
oss-stable-rc/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.node.unbundled.production.js +0.31% 91.80 kB 92.09 kB +0.47% 18.86 kB 18.95 kB
oss-stable-semver/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.node.unbundled.production.js +0.31% 91.80 kB 92.09 kB +0.47% 18.86 kB 18.95 kB
oss-stable/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.node.unbundled.production.js +0.31% 91.80 kB 92.09 kB +0.47% 18.86 kB 18.95 kB
oss-stable-rc/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.production.js +0.31% 92.73 kB 93.02 kB +0.41% 19.09 kB 19.17 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.production.js +0.31% 92.73 kB 93.02 kB +0.41% 19.09 kB 19.17 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.production.js +0.31% 92.73 kB 93.02 kB +0.41% 19.09 kB 19.17 kB
oss-stable-rc/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.node.production.js +0.31% 92.76 kB 93.05 kB +0.41% 19.08 kB 19.16 kB
oss-stable-semver/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.node.production.js +0.31% 92.76 kB 93.05 kB +0.41% 19.08 kB 19.16 kB
oss-stable/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.node.production.js +0.31% 92.76 kB 93.05 kB +0.41% 19.08 kB 19.16 kB
oss-experimental/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.browser.production.js +0.30% 92.92 kB 93.20 kB +0.39% 19.04 kB 19.11 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-server.browser.production.js +0.30% 93.24 kB 93.52 kB +0.40% 19.13 kB 19.21 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-server.edge.production.js +0.30% 93.34 kB 93.62 kB +0.40% 19.16 kB 19.24 kB
oss-experimental/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.edge.production.js +0.30% 93.37 kB 93.65 kB +0.40% 19.16 kB 19.24 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.unbundled.production.js +0.30% 95.41 kB 95.69 kB +0.38% 19.51 kB 19.59 kB
oss-experimental/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.node.unbundled.production.js +0.30% 95.43 kB 95.71 kB +0.39% 19.52 kB 19.59 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.production.js +0.29% 96.36 kB 96.64 kB +0.39% 19.73 kB 19.81 kB
oss-experimental/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.node.production.js +0.29% 96.39 kB 96.67 kB +0.39% 19.72 kB 19.80 kB
oss-stable-rc/react-server/cjs/react-server-flight.development.js +0.29% 80.22 kB 80.45 kB +0.43% 14.93 kB 15.00 kB
oss-stable-semver/react-server/cjs/react-server-flight.development.js +0.29% 80.22 kB 80.45 kB +0.43% 14.93 kB 15.00 kB
oss-stable/react-server/cjs/react-server-flight.development.js +0.29% 80.22 kB 80.45 kB +0.43% 14.93 kB 15.00 kB
oss-stable-rc/react-server-dom-esm/cjs/react-server-dom-esm-server.node.development.js +0.26% 119.96 kB 120.27 kB +0.37% 22.41 kB 22.50 kB
oss-stable-semver/react-server-dom-esm/cjs/react-server-dom-esm-server.node.development.js +0.26% 119.96 kB 120.27 kB +0.37% 22.41 kB 22.50 kB
oss-stable/react-server-dom-esm/cjs/react-server-dom-esm-server.node.development.js +0.26% 119.96 kB 120.27 kB +0.37% 22.41 kB 22.50 kB
oss-experimental/react-server/cjs/react-server-flight.development.js +0.25% 91.89 kB 92.12 kB +0.38% 17.06 kB 17.13 kB
oss-stable-rc/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.browser.development.js +0.25% 123.85 kB 124.16 kB +0.33% 23.02 kB 23.10 kB
oss-stable-semver/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.browser.development.js +0.25% 123.85 kB 124.16 kB +0.33% 23.02 kB 23.10 kB
oss-stable/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.browser.development.js +0.25% 123.85 kB 124.16 kB +0.33% 23.02 kB 23.10 kB
oss-stable-rc/react-server-dom-webpack/cjs/react-server-dom-webpack-server.browser.development.js +0.25% 124.48 kB 124.79 kB +0.32% 23.20 kB 23.27 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-server.browser.development.js +0.25% 124.48 kB 124.79 kB +0.32% 23.20 kB 23.27 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-server.browser.development.js +0.25% 124.48 kB 124.79 kB +0.32% 23.20 kB 23.27 kB
oss-stable-rc/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.edge.development.js +0.25% 124.68 kB 124.99 kB +0.31% 23.20 kB 23.27 kB
oss-stable-semver/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.edge.development.js +0.25% 124.68 kB 124.99 kB +0.31% 23.20 kB 23.27 kB
oss-stable/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.edge.development.js +0.25% 124.68 kB 124.99 kB +0.31% 23.20 kB 23.27 kB
oss-stable-rc/react-server-dom-webpack/cjs/react-server-dom-webpack-server.edge.development.js +0.25% 124.84 kB 125.14 kB +0.31% 23.26 kB 23.34 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-server.edge.development.js +0.25% 124.84 kB 125.14 kB +0.31% 23.26 kB 23.34 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-server.edge.development.js +0.25% 124.84 kB 125.14 kB +0.31% 23.26 kB 23.34 kB
oss-stable-rc/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.node.unbundled.development.js +0.24% 126.33 kB 126.63 kB +0.33% 23.38 kB 23.45 kB
oss-stable-semver/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.node.unbundled.development.js +0.24% 126.33 kB 126.63 kB +0.33% 23.38 kB 23.45 kB
oss-stable/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.node.unbundled.development.js +0.24% 126.33 kB 126.63 kB +0.33% 23.38 kB 23.45 kB
oss-stable-rc/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.unbundled.development.js +0.24% 126.49 kB 126.79 kB +0.33% 23.43 kB 23.51 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.unbundled.development.js +0.24% 126.49 kB 126.79 kB +0.33% 23.43 kB 23.51 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.unbundled.development.js +0.24% 126.49 kB 126.79 kB +0.33% 23.43 kB 23.51 kB
oss-stable-rc/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.node.development.js +0.24% 127.43 kB 127.74 kB +0.33% 23.64 kB 23.72 kB
oss-stable-semver/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.node.development.js +0.24% 127.43 kB 127.74 kB +0.33% 23.64 kB 23.72 kB
oss-stable/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.node.development.js +0.24% 127.43 kB 127.74 kB +0.33% 23.64 kB 23.72 kB
oss-stable-rc/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.development.js +0.24% 127.58 kB 127.89 kB +0.33% 23.70 kB 23.78 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.development.js +0.24% 127.58 kB 127.89 kB +0.33% 23.70 kB 23.78 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.development.js +0.24% 127.58 kB 127.89 kB +0.33% 23.70 kB 23.78 kB
oss-experimental/react-server-dom-esm/cjs/react-server-dom-esm-server.node.development.js +0.23% 131.74 kB 132.05 kB +0.32% 24.66 kB 24.74 kB
oss-experimental/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.browser.development.js +0.23% 135.49 kB 135.80 kB +0.31% 25.24 kB 25.32 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-server.browser.development.js +0.23% 136.11 kB 136.42 kB +0.31% 25.41 kB 25.49 kB
oss-experimental/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.edge.development.js +0.23% 136.65 kB 136.96 kB +0.30% 25.46 kB 25.53 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-server.edge.development.js +0.23% 136.80 kB 137.11 kB +0.30% 25.52 kB 25.59 kB
oss-experimental/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.node.unbundled.development.js +0.22% 138.11 kB 138.41 kB +0.30% 25.63 kB 25.71 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.unbundled.development.js +0.22% 138.27 kB 138.58 kB +0.30% 25.69 kB 25.77 kB
oss-experimental/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.node.development.js +0.22% 139.22 kB 139.52 kB +0.29% 25.89 kB 25.96 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.development.js +0.22% 139.36 kB 139.67 kB +0.29% 25.95 kB 26.02 kB
test_utils/ReactAllWarnings.js Deleted 62.88 kB 0.00 kB Deleted 15.69 kB 0.00 kB

Generated by 🚫 dangerJS against 1285d5c

Copy link
Member

@kassens kassens left a comment

Choose a reason for hiding this comment

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

makes sense to me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed React Core Team Opened by a member of the React Core Team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants