facebook / react

The library for web and native user interfaces.
https://react.dev
MIT License
224.3k stars 45.71k forks source link

compiler: Improve merging of memo scopes that invalidate together #29156

Closed josephsavona closed 3 weeks ago

josephsavona commented 1 month ago

Stack from ghstack (oldest at bottom):

Improves merging of consecutive scopes so that we now merge two scopes if the dependencies of the second scope are a subset of the previous scope's output and that dependency has a type that will always produce a new value (array, object, jsx, function) if it is re-evaluated.

To make this easier, we extend the set of builtin types to include ones for function expressions and JSX and to infer these types in InferTypes. This allows using the already inferred types in MergeReactiveScopesThatInvalidateTogether.

vercel[bot] commented 1 month ago

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 May 21, 2024 0:17am
react-sizebot commented 1 month ago

Comparing: bf046e86531141d0eb9ffc1165f775a57ffb00f5...ce4e19d0ec047172a1d15423e8453a40e2f172b5

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.66 kB 6.66 kB = 1.82 kB 1.82 kB
oss-stable/react-dom/cjs/react-dom-client.production.js = 495.71 kB 495.71 kB = 88.78 kB 88.78 kB
oss-experimental/react-dom/cjs/react-dom.production.js = 6.67 kB 6.67 kB = 1.83 kB 1.82 kB
oss-experimental/react-dom/cjs/react-dom-client.production.js = 500.51 kB 500.51 kB = 89.47 kB 89.47 kB
facebook-www/ReactDOM-prod.classic.js = 592.86 kB 592.86 kB = 104.28 kB 104.28 kB
facebook-www/ReactDOM-prod.modern.js = 569.08 kB 569.08 kB = 100.69 kB 100.69 kB
__test_utils__/ReactAllWarnings.js Deleted 64.35 kB 0.00 kB Deleted 16.05 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 | | ---- | --- | ---- | ------- | -------- | --------- | ------------ | | [__test_utils__/ReactAllWarnings.js](https://react-builds.vercel.app/commits/ce4e19d0ec047172a1d15423e8453a40e2f172b5/files/__test_utils__/ReactAllWarnings.js?compare=bf046e86531141d0eb9ffc1165f775a57ffb00f5) | **Deleted** | 64.35 kB | 0.00 kB | Deleted | 16.05 kB | 0.00 kB

Generated by :no_entry_sign: dangerJS against ce4e19d0ec047172a1d15423e8453a40e2f172b5