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

[Fizz] Simplify ReplayNode data structure #27395

Merged
merged 3 commits into from
Sep 21, 2023

Conversation

sebmarkbage
Copy link
Collaborator

@sebmarkbage sebmarkbage commented Sep 20, 2023

The key is that instead of storing different tags of resumable points, we just store if a replay node has any resumable slots and if that's at the root number or if it has resumable slots by index.

This is a simpler and more compact format because we don't have to separate the three Resume forms.

This helps deal with Postpone in fallbacks because it doesn't just double all the cases.

This is a simpler and more compact format because we don't have to
separate the three Resume forms.
This lets us share logic between resume/replaySuspenseBoundary.
@facebook-github-bot facebook-github-bot added CLA Signed React Core Team Opened by a member of the React Core Team labels Sep 20, 2023
string | null /* name */,
string | number /* key */,
Array<ResumableNode> /* children */,
Array<ReplayNode> /* keyed children */,
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Instead of storing the key on the node we could also turn this into two keyed objects. One of number keys and one for string keys.

@react-sizebot
Copy link

Comparing: 2807d78...fb7db0c

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.min.js = 166.62 kB 166.62 kB = 52.13 kB 52.13 kB
oss-experimental/react-dom/cjs/react-dom.production.min.js = 176.05 kB 176.05 kB = 54.97 kB 54.97 kB
facebook-www/ReactDOM-prod.classic.js = 571.73 kB 571.73 kB = 100.64 kB 100.64 kB
facebook-www/ReactDOM-prod.modern.js = 555.46 kB 555.46 kB = 97.75 kB 97.75 kB
oss-experimental/react-server/cjs/react-server.development.js = 200.27 kB 195.68 kB = 45.65 kB 45.38 kB
oss-stable-semver/react-server/cjs/react-server.production.min.js = 33.92 kB 33.13 kB = 10.68 kB 10.46 kB
oss-stable/react-server/cjs/react-server.production.min.js = 33.92 kB 33.13 kB = 10.68 kB 10.46 kB
oss-stable-semver/react-server/cjs/react-server.development.js = 183.78 kB 178.59 kB = 41.85 kB 41.42 kB
oss-stable/react-server/cjs/react-server.development.js = 183.78 kB 178.59 kB = 41.85 kB 41.42 kB

Significant size changes

Includes any change greater than 0.2%:

Expand to show
Name +/- Base Current +/- gzip Base gzip Current gzip
oss-experimental/react-dom/umd/react-dom-server.browser.production.min.js = 75.49 kB 75.07 kB = 23.17 kB 23.02 kB
oss-experimental/react-dom/cjs/react-dom-server.browser.production.min.js = 75.37 kB 74.94 kB = 22.88 kB 22.71 kB
oss-experimental/react-dom/cjs/react-dom-server.node.production.min.js = 80.97 kB 80.47 kB = 24.70 kB 24.55 kB
oss-experimental/react-dom/cjs/react-dom-server.edge.production.min.js = 80.71 kB 80.21 kB = 24.53 kB 24.37 kB
oss-experimental/react-dom/umd/react-dom-server-legacy.browser.production.min.js = 72.62 kB 72.11 kB = 22.16 kB 21.97 kB
oss-experimental/react-dom/cjs/react-dom-server-legacy.browser.production.min.js = 72.47 kB 71.96 kB = 21.81 kB 21.61 kB
oss-experimental/react-dom/cjs/react-dom-server-legacy.node.production.min.js = 78.52 kB 77.93 kB = 23.63 kB 23.46 kB
oss-experimental/react-dom/cjs/react-dom-server.bun.production.min.js = 76.95 kB 76.36 kB = 23.33 kB 23.19 kB
oss-stable/react-dom/umd/react-dom-server.browser.production.min.js = 69.32 kB 68.65 kB = 21.57 kB 21.36 kB
oss-stable-semver/react-dom/umd/react-dom-server.browser.production.min.js = 69.29 kB 68.63 kB = 21.54 kB 21.34 kB
oss-stable/react-dom/cjs/react-dom-server.browser.production.min.js = 69.18 kB 68.51 kB = 21.30 kB 21.06 kB
oss-stable-semver/react-dom/cjs/react-dom-server.browser.production.min.js = 69.15 kB 68.49 kB = 21.28 kB 21.03 kB
oss-stable/react-dom/umd/react-dom-server-legacy.browser.production.min.js = 68.33 kB 67.67 kB = 20.67 kB 20.46 kB
oss-stable-semver/react-dom/umd/react-dom-server-legacy.browser.production.min.js = 68.30 kB 67.64 kB = 20.65 kB 20.43 kB
oss-stable/react-dom/cjs/react-dom-server-legacy.browser.production.min.js = 68.17 kB 67.51 kB = 20.36 kB 20.10 kB
oss-stable-semver/react-dom/cjs/react-dom-server-legacy.browser.production.min.js = 68.14 kB 67.48 kB = 20.34 kB 20.08 kB
oss-experimental/react-dom/umd/react-dom-server.browser.development.js = 418.87 kB 414.10 kB = 87.51 kB 87.19 kB
oss-experimental/react-dom/cjs/react-dom-server.node.development.js = 401.08 kB 396.49 kB = 86.81 kB 86.54 kB
oss-experimental/react-dom/cjs/react-dom-server.edge.development.js = 400.20 kB 395.60 kB = 86.61 kB 86.35 kB
oss-experimental/react-dom/cjs/react-dom-server.browser.development.js = 399.79 kB 395.19 kB = 86.49 kB 86.22 kB
oss-experimental/react-dom/umd/react-dom-server-legacy.browser.development.js = 412.72 kB 407.77 kB = 86.77 kB 86.40 kB
oss-experimental/react-dom/cjs/react-dom-server-legacy.node.development.js = 395.84 kB 391.07 kB = 86.20 kB 85.90 kB
oss-stable/react-dom/cjs/react-dom-server.node.production.min.js = 74.34 kB 73.44 kB = 22.92 kB 22.66 kB
oss-stable-semver/react-dom/cjs/react-dom-server.node.production.min.js = 74.31 kB 73.42 kB = 22.89 kB 22.64 kB
oss-stable/react-dom/cjs/react-dom-server.edge.production.min.js = 74.29 kB 73.39 kB = 22.85 kB 22.60 kB
oss-stable-semver/react-dom/cjs/react-dom-server.edge.production.min.js = 74.26 kB 73.37 kB = 22.82 kB 22.58 kB
oss-stable/react-dom/cjs/react-dom-server-legacy.node.production.min.js = 73.97 kB 73.08 kB = 22.14 kB 21.90 kB
oss-stable-semver/react-dom/cjs/react-dom-server-legacy.node.production.min.js = 73.95 kB 73.05 kB = 22.11 kB 21.88 kB
oss-experimental/react-dom/cjs/react-dom-server-legacy.browser.development.js = 393.93 kB 389.16 kB = 85.74 kB 85.44 kB
oss-experimental/react-dom/cjs/react-dom-server.bun.development.js = 391.43 kB 386.65 kB = 85.30 kB 85.00 kB
oss-stable/react-dom/cjs/react-dom-server.bun.production.min.js = 72.40 kB 71.50 kB = 21.86 kB 21.62 kB
oss-stable-semver/react-dom/cjs/react-dom-server.bun.production.min.js = 72.38 kB 71.48 kB = 21.83 kB 21.60 kB
oss-experimental/react-server/cjs/react-server.production.min.js = 36.95 kB 36.47 kB = 11.57 kB 11.42 kB
facebook-www/ReactDOMServer-dev.classic.js = 393.85 kB 388.47 kB = 85.09 kB 84.59 kB
facebook-www/ReactDOMServer-dev.modern.js = 386.42 kB 381.05 kB = 83.45 kB 82.95 kB
facebook-www/ReactDOMServerStreaming-dev.modern.js = 381.61 kB 376.24 kB = 82.29 kB 81.80 kB
oss-stable/react-dom/umd/react-dom-server.browser.development.js = 390.04 kB 384.46 kB = 82.49 kB 82.01 kB
oss-stable-semver/react-dom/umd/react-dom-server.browser.development.js = 390.02 kB 384.43 kB = 82.46 kB 81.98 kB
oss-stable/react-dom/umd/react-dom-server-legacy.browser.development.js = 389.77 kB 384.18 kB = 82.01 kB 81.52 kB
oss-stable-semver/react-dom/umd/react-dom-server-legacy.browser.development.js = 389.74 kB 384.16 kB = 81.98 kB 81.50 kB
oss-stable/react-dom/cjs/react-dom-server-legacy.node.development.js = 373.76 kB 368.40 kB = 81.60 kB 81.12 kB
oss-stable-semver/react-dom/cjs/react-dom-server-legacy.node.development.js = 373.74 kB 368.37 kB = 81.57 kB 81.09 kB
oss-stable/react-dom/cjs/react-dom-server.node.development.js = 373.60 kB 368.24 kB = 81.64 kB 81.17 kB
oss-stable-semver/react-dom/cjs/react-dom-server.node.development.js = 373.58 kB 368.21 kB = 81.61 kB 81.15 kB
oss-stable/react-dom/cjs/react-dom-server.edge.development.js = 372.53 kB 367.17 kB = 81.74 kB 81.27 kB
oss-stable-semver/react-dom/cjs/react-dom-server.edge.development.js = 372.51 kB 367.14 kB = 81.71 kB 81.24 kB
oss-stable/react-dom/cjs/react-dom-server.browser.development.js = 372.12 kB 366.76 kB = 81.62 kB 81.15 kB
oss-stable-semver/react-dom/cjs/react-dom-server.browser.development.js = 372.10 kB 366.73 kB = 81.59 kB 81.12 kB
oss-stable/react-dom/cjs/react-dom-server-legacy.browser.development.js = 371.85 kB 366.49 kB = 81.14 kB 80.66 kB
oss-stable-semver/react-dom/cjs/react-dom-server-legacy.browser.development.js = 371.83 kB 366.46 kB = 81.11 kB 80.63 kB
oss-stable/react-dom/cjs/react-dom-server.bun.development.js = 369.35 kB 363.98 kB = 80.71 kB 80.24 kB
oss-stable-semver/react-dom/cjs/react-dom-server.bun.development.js = 369.32 kB 363.96 kB = 80.68 kB 80.21 kB
facebook-www/ReactDOMServer-prod.classic.js = 178.90 kB 175.79 kB = 31.63 kB 31.35 kB
facebook-www/ReactDOMServer-prod.modern.js = 177.97 kB 174.85 kB = 31.38 kB 31.10 kB
facebook-www/ReactDOMServerStreaming-prod.modern.js = 181.80 kB 178.32 kB = 32.61 kB 32.23 kB
oss-experimental/react-server/cjs/react-server.development.js = 200.27 kB 195.68 kB = 45.65 kB 45.38 kB
oss-stable-semver/react-server/cjs/react-server.production.min.js = 33.92 kB 33.13 kB = 10.68 kB 10.46 kB
oss-stable/react-server/cjs/react-server.production.min.js = 33.92 kB 33.13 kB = 10.68 kB 10.46 kB
oss-stable-semver/react-server/cjs/react-server.development.js = 183.78 kB 178.59 kB = 41.85 kB 41.42 kB
oss-stable/react-server/cjs/react-server.development.js = 183.78 kB 178.59 kB = 41.85 kB 41.42 kB

Generated by 🚫 dangerJS against fb7db0c

@sebmarkbage sebmarkbage merged commit 47fed69 into facebook:main Sep 21, 2023
2 checks passed
github-actions bot pushed a commit that referenced this pull request Sep 21, 2023
The key is that instead of storing different tags of resumable points,
we just store if a replay node has any resumable slots and if that's at
the root `number` or if it has resumable slots by index.

This is a simpler and more compact format because we don't have to
separate the three Resume forms.

This helps deal with Postpone in fallbacks because it doesn't just
double all the cases.

DiffTrain build for [47fed69](47fed69)
EdisonVan pushed a commit to EdisonVan/react that referenced this pull request Apr 15, 2024
The key is that instead of storing different tags of resumable points,
we just store if a replay node has any resumable slots and if that's at
the root `number` or if it has resumable slots by index.

This is a simpler and more compact format because we don't have to
separate the three Resume forms.

This helps deal with Postpone in fallbacks because it doesn't just
double all the cases.
bigfootjon pushed a commit that referenced this pull request Apr 18, 2024
The key is that instead of storing different tags of resumable points,
we just store if a replay node has any resumable slots and if that's at
the root `number` or if it has resumable slots by index.

This is a simpler and more compact format because we don't have to
separate the three Resume forms.

This helps deal with Postpone in fallbacks because it doesn't just
double all the cases.

DiffTrain build for commit 47fed69.
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