dillon1000/react
Commit
Browse files Prune scopes whose deps always invalidate
Implements the optimization described in the previous PR: if we know that a scope's dependency will _always_ invalidate (it is not memoized and it is guaranteed to be a new object if the instruction executes, such as an array or object literal), then we can prune that scope. The invalidation is transitive: we track always-invalidating types from within scopes, and if their scope gets invalidated we prune downstream scope that depend on them. ## Test Plan Tested via #2639 - see https://fburl.com/everpaste/3e3hjpjs. 91 files change output due to reactive scopes which would always invalidate due to always invalidating dependencies.
Changed paths5 files
First-parent comparisoncompiler/packages/babel-plugin-react-forget/src/Entrypoint/Pipeline.ts ModifiedA compiler/packages/babel-plugin-react-forget/src/ReactiveScopes/PruneAlwaysInvalidatingScopes.ts AddedM compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/prune-scopes-whose-deps-invalidate-array.expect.md ModifiedM compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/prune-scopes-whose-deps-invalidate-new.expect.md ModifiedM compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/prune-scopes-whose-deps-invalidate-object.expect.md ModifiedPatch
Files changed
Rendering syntax-highlighted changes…