The Wire · Showcase
React Compiler slashes codegen time by 70%
By RepoJournal · Filed · About Meta
The React Compiler's Rust rewrite just got dramatically faster, with codegen times dropping by up to 70% on heavy payloads.
Two optimizations landed in the React Compiler that target the Rust backend's biggest bottleneck: deep AST clones. The first avoids a deep clone of the AST during codegen, cutting peak memory allocation by 5-15% and codegen time by 30-70% depending on payload [1]. The second shrinks AbstractValue from 72 bytes plus heap allocations down to 18 bytes by replacing IndexSet with an inline array, eliminating heap allocation and memory thrash entirely [2]. And the team didn't stop there: a CI change now shards build workers by measured bundle build times, fixing a round-robin scheme that left the slowest worker at 56-62 seconds of rollup time while the mean sat at 40-42 seconds [3]. Meanwhile, the Rust compiler now bails out on nested TypeScript `this` parameters instead of silently producing a partial function, closing a footgun that could generate broken HIR [4]. Over in React Native, iOS TurboModule codegen now accepts Double, Float, and Int32 as EventEmitter payloads, aligning with Android and C++ behavior [5]. A separate fix ensures asset catalog scale-to-file pairing doesn't ship the wrong images when assets have non-standard scales like 1.5x [6]. The React Native team also dropped an unused field from SPM module config and removed a legacy glob prefix, both internal cleanups [7][8].
One email a day. Unsubscribe in one click.
Keep up with Meta in about 3 minutes a day: what actually shipped — the commits, pull requests, releases, and security advisories that matter.
One email a day. Unsubscribe in one click. Read a past issue →
Action items
- → Pull the latest React Compiler changes and re-run your heavy component benchmarks facebook/react [plan]
- → If you use Rust compiler with TypeScript `this` params, verify raised errors now surface instead of silent partial compilation facebook/react [monitor]
- → If you ship iOS apps with TurboModules using explicit number types in EventEmitter payloads, test after the next React Native release facebook/react-native [plan]
- → Review asset catalogs for non-standard scale images before next release facebook/react-native [plan]
References
- [1] React Compiler: avoid deep ast clone and quadratic-time codegen ↗ facebook/react
- [2] React Compiler: Make AbstractValue Copy to reduce heap allocation ↗ facebook/react
- [3] [ci] Shard build workers by measured bundle build times ↗ facebook/react
- [4] [rust-compiler] Bail out on nested TypeScript `this` parameters (#37232) facebook/react
- [5] Align TurboModule EventEmitter payload types across platforms (#58063) facebook/react-native
- [6] Fix asset catalog scale-to-file pairing for assets with non-standard scales (#57825) facebook/react-native
- [7] Drop the inert publicHeadersPath from spm.modules (#58059) facebook/react-native
- [8] Remove glob: prefix in oss projects (#58100) facebook/react-native