Source linked

React Compiler Goes Rust: 3x أسرع Babel Plugin، 10x أسرع منطق

يستخدم مطار Rust التجريبي جميع المطارات 1725 ويستخدم نفس معمارية HIR / CFG ، مما يمنح التكاملات الأصلية أسرع من أيضًا مع OXC و SWC.

reactrustbabeloxcswcmeta

React Compiler's Rust port already runs 3x faster than its TypeScript original as a Babel plugin, with the actual transformation logic clocking in at 10x faster. Joseph Savona posted the PR on March 30, 2026, calling it experimental and work-in-progress, but all 1725 fixtures pass with identical output and per-pass intermediate representations.

The Numbers That Matter

3x faster as a Babel plugin sounds good; the 10x figure on transformation logic alone is the real story. Serialization eats into the gains, but even the net result beats the TypeScript version. Savona is upfront that the benchmark setup isn't fully validated yet, but the optimization opportunities the AI-derived performance numbers pointed to were real and the fixes were correct. Native integrations with OXC and SWC should push speeds even higher since they avoid Babel's serialization overhead altogether.

Architecture: Same Passes, Different Data Structures

The Rust version deliberately mirrors the TypeScript compiler's architecture: convert from a Babel-like AST into High-level Intermediate Representation (HIR) using control-flow graphs and single-static assignment. Every pass is a direct port. The difference is in data representation — arena-like structures with indices replace heap-allocated objects to satisfy Rust's borrowing rules. Savona and AI coded the majority, but he set the architecture, testing strategy, and incremental migration approach. The internal state after each pass is nearly identical between the two versions, modulo some ID normalization.

Three Integrations and a Migration Plan

Savona ships three integrations right now: a Babel plugin (eventually to be merged into babel-plugin-react-compiler), plus example crates for OXC and SWC. The public API is "Rust Babel AST" plus scope info in, same out — each integration converts to and from its native AST. Scope analysis isn't implemented yet; the compiler relies on external scope data, a limitation from the TypeScript version. Future plans include computing bindings internally and returning patches instead of replacing the entire program. With OXC and SWC integrations already running, expect the Rust compiler to become the default path for production builds.


Source: Port React Compiler to Rust
Domain: github.com

Read original source ->

External source stays available while the OJO article and comment thread stay local.

Comments load interactively on the live page.