dillon1000/react
Commit
Browse files compiler: Log metrics on pruned memo blocks/values
Adds additional information to the CompileSuccess LoggerEvent: * `prunedMemoBlocks` is the number of reactive scopes that were pruned for some reason. * `prunedMemoValues` is the number of unique _values_ produced by those scopes. Both numbers exclude blocks that are just a hook call - ie although we create and prune a scope for eg `useState()`, that's just an artifact of the sequencing of our pipeline. So what this metric is counting is cases of _other_ values that go unmemoized. See the new fixture, which takes advantage of improvements in the snap runner to optionally emit the logger events in the .expect.md file if you include the "logger" pragma in a fixture. ghstack-source-id: c2015bb5565746d07427587526b71e23685279c2 Pull Request resolved: https://github.com/facebook/react/pull/29810
Changed paths8 files
First-parent comparisoncompiler/packages/babel-plugin-react-compiler/src/Entrypoint/Options.ts ModifiedM compiler/packages/babel-plugin-react-compiler/src/Entrypoint/Program.ts ModifiedM compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes/CodegenReactiveFunction.ts ModifiedA compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/log-pruned-memoization.expect.md AddedA compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/log-pruned-memoization.js AddedM compiler/packages/snap/src/compiler.ts ModifiedM compiler/packages/snap/src/reporter.ts ModifiedM compiler/packages/snap/src/runner-worker.ts ModifiedPatch
Files changed
Rendering syntax-highlighted changes…