React Compiler Internals
summary
A tiny compiler parses a React component with a Babel parser into flat instruction IDs, then identifies which instructions to memoize, computes precise dependency arrays, and detects writable results so adjacent useMemo calls get merged. Two lines of input expand into about ten memo calls before analysis prunes and consolidates them. The demo builds this pipeline, emits transformed code that runs, and notes gaps left out (hooks, full passes) plus a simple fix for aliasing.
AI-written summary · about
chapters (11)
- 0:00Introduction to compiler
- 1:28Setting up the demo
- 5:48Generating low-level instructions
- 8:17Analyzing memoization needs
- 11:58Computing changing values
- 14:09Fixing dependency arrays
- 17:44Detecting writable values
- 20:34Finalizing the compiler
- 21:59Handling aliasing issues
- 22:20Real compiler output
- 23:25Summary and next steps
related talks
30mReact Compiler
37mThe magic behind the React compiler
19mWhat's next for the React Compiler?
19mReact Complier - deep dive into performance
20mExperiments with React Compiler in Production Code
28mStop Memoizing with “React Forget”
20mIn case you missed the memo
32mHow React Compiler Performs on Real Code
