[compiler] Add experimental trace-tape runtime and opt-in emission prototype#36303
[compiler] Add experimental trace-tape runtime and opt-in emission prototype#36303luckysolanki902 wants to merge 4 commits intofacebook:mainfrom
Conversation
|
Hi @luckysolanki902! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks! |
|
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
Summary
react-compiler-runtimeComponent.__traceTapefor a tiny annotated JSX subsetWhy
This prototypes an out-of-the-box execution model experiment: recording a render as branch guards plus dependency-driven patch operations, then replaying stable-path updates without re-running the entire render callback.
The compiler-side change stays intentionally narrow. It only emits a trace-tape companion when both of these are true:
enableEmitTraceTapeflag is enabled'use trace tape'and matches a tiny pure subset (singlereturnof one JSX element with direct prop-member reads)That keeps the prototype honest: the PR demonstrates a concrete codegen seam without implying that arbitrary React can already lower into this execution model.
Validation
yarn workspace react-compiler-runtime buildyarn workspace react-compiler-runtime testyarn workspace react-compiler-runtime benchmark:trace-tapeyarn workspace babel-plugin-react-compiler buildyarn workspace babel-plugin-react-compiler run jest parseConfigPragma-test.tsyarn workspace babel-plugin-react-compiler run snap -p trace-tape-annotationyarn workspace babel-plugin-react-compiler testBenchmark
On the included synthetic benchmark of 20,000 stable-path updates: