Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53399
We currently create application template that are still using `ReactNativeHost`.
As this is a legacy arch class, we should remove it from the template ASAP so that
users can organically migrate away from it.
I will also update https://github.com/react-native-community/template with
the same changes I'm applying here.
Changelog:
[Internal] [Changed] -
Reviewed By: mdvacca
Differential Revision: D80708461
fbshipit-source-id: e0d4a1f817e6fdddd93405decf77fd115956ec51
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53362
Changelog: [internal]
This just replaces the polyfills for `Event` and `EventTarget` that we're defining inline in Fantom with the implementations that already exist in RN.
Reviewed By: javache
Differential Revision: D80612067
fbshipit-source-id: 047c8f12cbb1f4afea2d05a5a1235d9dff2e25f9
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53320
Changelog: [internal]
This improves the defaults the options related to minimum number of iterations and test duration in benchmarks.
If you indicate a minimum duration, we set the minimum number of iterations so the duration is honored. We do the same if what's specified is the number of iterations.
This is useful when you want to make sure all the tests in a benchmark suite use the same number of iterations without having to explicitly set the time to 0 in all of them.
It also changes the default for warmup iterations to be just 1 (that's enough to load all modules and all the code into memory).
Reviewed By: rshest
Differential Revision: D80405287
fbshipit-source-id: 41a61c4d1979db6a25dd30f0c84b5de319416885
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53321
Changelog: [internal]
Just a rename to make it easier to understand.
Reviewed By: rshest
Differential Revision: D80404378
fbshipit-source-id: 3d7e89797be3b92599e07b4b64d2a720756a4f3b
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53322
Changelog: [internal]
This changes the types for benchmark functions to improve safety:
1. It makes the return object be an object instead of an interface, to catch when `overriddenDuration` is misspelled.
2. It makes the function always synchronous, as asynchronous tests aren't supported in Fantom (even though they are in `tinybench`).
Reviewed By: rshest
Differential Revision: D80404121
fbshipit-source-id: c0e2fb9f67174432f50e31c399f5b10cfe098ae6
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53323
Changelog: [internal]
This just makes it easier to understand when the benchmark itself has started running and how long the benchmark itself took to run.
Reviewed By: rshest
Differential Revision: D80400268
fbshipit-source-id: b447c4c389d563f7b2b1cbe82822d5d3a93272da
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53278
changelog: [internal]
C++ Animated should be in ReactCommon, it is code shared across all platforms.
Reviewed By: christophpurrer, zeyap
Differential Revision: D80261447
fbshipit-source-id: 8ad5d0bb65c9b499b1d9f60fc8babef8d4d90078
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53300
# Changelog:
[Internal] -
This adds two new modes to Fantom, allowing to run the native (C++) side with enabling either:
* Address sanitizer, which would detect memory overwrites
* Thread sanitizer, which can detect potential threading issues, such as race conditions
This are opt-in for now.
Currently, both modes already detect different errors, which have a high chance to be real issues and have to be fixed.
Reviewed By: lenaic
Differential Revision: D80339524
fbshipit-source-id: 784ddb9f0af79a04b074e107e4955724d54d5685
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53281
This is still a of bumping Gradle to the latest Major (9.0)
Full list of changes is here: https://gradle.org/whats-new/gradle-9/
I don't expect any breaking changes for React Native users.
Changelog:
[Android] [Breaking] - **deps:** Gradle to 9.0
Reviewed By: cipolleschi
Differential Revision: D79445941
fbshipit-source-id: 0af495a2cc6bb4cca1e37d5f0693b77e42010df2
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53250
Changelog: [internal]
This updates the types for Fantom benchmarks to support the new `overriddenDuration` option from `tinybench`.
It also exposes a new method in the benchmark namespace to access the same timestamp used in benchmarks.
Reviewed By: rshest
Differential Revision: D80169515
fbshipit-source-id: 59af197eababbf5b8544ee9f1862b206756dc87d
Summary:
While verifying the lock deduplication changes, I have spotted that `eslint-plugin-jest` package does not match Jest version used within the workspace.
## Changelog:
[INTERNAL][CHANGED] - update `eslint-plugin-jest` package in workspace to align with Jest version used
Pull Request resolved: https://github.com/facebook/react-native/pull/53246
Test Plan: Running `yarn test`, `yarn lint-ci` and `test-typescript` checks does not yield any errors.
Reviewed By: rshest, cortinico
Differential Revision: D80170591
Pulled By: robhogan
fbshipit-source-id: f3ac58bc26cf2d3a34899f8558f872b3df85942d
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53226
Changelog: [internal]
This adds documentation about how to take JS memory heap snapshots in Fantom.
Reviewed By: lenaic
Differential Revision: D80090283
fbshipit-source-id: 04f66a62aa756d1020b8d8ef6fc0ea7e68341710
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53228
Changelog: [internal]
This adds some documentation about how to debug Fantom tests (C++ and JS).
Reviewed By: lenaic
Differential Revision: D80090286
fbshipit-source-id: 435d2079abfe72e93de0c297347b15dc39b25a89
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53221
# Changelog:
[Internal] -
This changes the benchmark test results comparison print the results slightly differently, in particular it now uses the slowest result as a baseline and prints how much faster the other ones are (as opposed to printing "slower" previously).
This arguably brings a more positive vibe when looking into the benchmark results :)
Reviewed By: andrewdacenko
Differential Revision: D80082134
fbshipit-source-id: 7dc9c7c520afe08270d4f5da9031db02261690ba
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53215
Changelog: [internal]
This adds a new environment variable to Fantom that allows debugging the JS code in tests.
Usage:
```
FANTOM_DEBUG_JS=1 yarn fantom <test>
```
**Does NOT work in OSS yet**. We need to include a third-party library to send HTTP and WebSocket requests and implement a wrapper on top of it.
Reviewed By: christophpurrer
Differential Revision: D79883372
fbshipit-source-id: d077c373a036033344e61d58274d5cd14028bda4
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53205
Changelog: [internal]
This injects a custom Babel transform for Fantom tests that automatically injects `debugger` statements in the generated code. This simplifies debugging by providing a default interruption point in the test setup for the test author to decide what to debug.
This has no effect unless the debugger is opened, which isn't happening yet.
Reviewed By: rshest
Differential Revision: D79996000
fbshipit-source-id: 6153587264d293a067e359edba4f64f41898c506
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53202
Changelog: [internal]
Just a minor refactor to follow the convention of prefixing Fantom-related globals and environment variables.
Reviewed By: rshest
Differential Revision: D79804007
fbshipit-source-id: 0c9a57c1b08ae18ae03cd66d1a6ef9690e0dea42
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53204
Changelog: [internal]
This changes the logic to find an available port for Metro on Fantom to do this outside Metro. Before, we'd set `0` as the port for Metro to find an available port, but in a following change we'll need to know the port before calling into Metro. This allows that.
Reviewed By: rshest
Differential Revision: D79804005
fbshipit-source-id: 5c2e2f4acbba3a79771586799b65653d46b8fe72
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53112
## Changelog:
[Internal] [Changed] - Cache result when RenderOutput::render() is called
Rreviously, root.getRenderedOutput in fantom doesn't really reflect the result of direct manipulation from native animated (see the test case added here). This stack is enabling it.
* make RenderOutput an instance owned by TestMountingManager that can cache render result
* why is this needed - native animation's direct manipulation should modify the render result (analog to directly manipulating host views on a platform) instead of props on a StubView
* here i also make sure that `RenderOutput::render()` will only re calculate the render result for a tree after StubViewTree::mutate is called
Reviewed By: andrewdacenko
Differential Revision: D79737991
fbshipit-source-id: ee2193b708e319c1519b06bc672054c4f7105da1
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53161
Changelog: [internal]
This fixes a bug in the retry logic in Fantom when requesting bundles from Metro, where we cache the error from a previous attempt and use it to determine we didn't succeed after the attemps.
Reviewed By: rshest
Differential Revision: D79881488
fbshipit-source-id: 566b2d700db2f9653b9ea9acd577d7eb03770b76
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53143
# Changelog:
[Internal] -
This refactors the way Fantom benchmark test results are passed to the top level, making it type safe and more maintainable.
Reviewed By: andrewdacenko
Differential Revision: D79812707
fbshipit-source-id: d8bfef7e1b0c11b277a08f5e4c810f8c1efd7f89
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53097
# Changelog:
[Internal] -
This makes the benchmark results comparison printout, added in https://github.com/facebook/react-native/pull/52925, be done in a tabular form, so it's easier to read and copy/paste around.
Reviewed By: lenaic
Differential Revision: D79728695
fbshipit-source-id: 4dfc999ad4a9a8c2d67efdfce11aff75383cf645
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53071
Changelog: [internal]
The current API to take JS heap snapshots has some problems:
1. Ergonomics: it requires you to input the filepath where you want to store the snapshot. This isn't aligned with the behavior we have for JS traces where the output path is provided to you.
2. It doesn't work in optimized builds, as it requires a specific option in Hermes.
For 1), this replaces `Fantom.saveJSMemoryHeapSnapshot(filePath)` with `Fantom.takeJSMemoryHeapSnapshot()` that outputs the snapshot in a predefined path and prints it to the console.
For 2), this adds a new environment variable to force building Hermes with memory instrumentation (`FANTOM_ENABLE_JS_MEMORY_INSTRUMENTATION`). This is exposed as an option and not set by default because it has a performance overhead at runtime that we don't want to pay (especially in benchmarks).
This option only works when using Buck in development, because we want to generate this new binary type on demand when necessary, instead of making it part of the prebuilts we do before running tests in OSS and CI.
Reviewed By: lenaic
Differential Revision: D79642314
fbshipit-source-id: a2980616a495bd6dca29c0709a9581db6fb3f2cc
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53069
Changelog: [internal]
This changes the names of the JS traces from Fantom from using a unix timestamp in the file name to using the ISO date:
- From: `View-itest.js-1754406329686.cpuprofile`
- To: `View-itest.js-2025-08-05T15:05:29.686Z.cpuprofile`
Reviewed By: rshest
Differential Revision: D79646760
fbshipit-source-id: d8a654724c1abc2d3e285ee658c2d390d3241d82
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53091
# Changelog:
[Internal] -
This fixes some excessive printing from the benchmarking results, which happened even if there was no benchmarks ran.
Reviewed By: rubennorte
Differential Revision: D79719026
fbshipit-source-id: 0e75d97ae9c762cab25007bfab5ca8a6dc43e148
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52925
# Changelog:
[Internal] -
This adds an extra "ranking" report when running Fantom benchmark vs different React Feature flag configurations.
It can be very useful when implementing some particular optimization, to streamline the before/after comparison wit this optimization enabled/disabled.
Reviewed By: andrewdacenko
Differential Revision: D79269601
fbshipit-source-id: f29e761e313d6857e5b3ac65faf2a387a84be9df
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52827
Changelog: [internal]
This adds **support for creating Hermes/JS sampling profiler traces in Fantom**, which is especially useful when running benchmarks.
Usage:
```
FANTOM_PROFILE_JS=1 yarn fantom Animated-benchmark
```
Output:
{F1980642216}
After this, the trace is fully symbolicated.
Can be opened directly in Google Chrome:
{F1980642229}
Or in the built-in viewer in VSCode:
{F1980642242} {F1980642240} {F1980642241}
When collapsing frames in the Flame Chart viewer in VSCode, we can quickly identify opportunities for optimizations.
This also supports multi-config environments. In that case, trace file names are created using a short representation of the configuration.
User guide for benchmarks in Fantom, including how to use this, will be done in a future diff.
NOTE: This still doesn't work in OSS because we don't support optimized mode there. In dev mode, there's a segmentation fault coming from this line: `hermesRuntime->sampledTraceToStreamInDevToolsFormat(fileStream)`
Reviewed By: sammy-SC
Differential Revision: D78905646
fbshipit-source-id: 382ddd5034db601309bd118cedde2fe0d57fde98
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53034
Changelog: [internal]
This is just a refactor to make sure that the constants we pass from the Fantom runner to its runtime are correct by using Flow to typecheck it.
Reviewed By: andrewdacenko
Differential Revision: D79565574
fbshipit-source-id: cbbab9cdec5ef5b3c82b929b8939c76c0ef41823
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53025
It's now time to say goodbye to the Legacy Architecture :')
This change hardcodes the `newArchEnabled` property to true, and warns the users
if they're attempting to set it to false.
Changelog:
[Android] [Breaking] - Remove possibility to newArchEnabled=false in 0.82
Reviewed By: cipolleschi
Differential Revision: D78560296
fbshipit-source-id: ccfc45d2f7f21cc20e063cb901d76be3d41458d6
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53019
Changelog: [internal]
This adds support for mocking `HighResTimeStamp` values in Fantom tests via a new `Fantom.installHighResTimeStampMock` function.
See new tests for more details on how it works.
Reviewed By: rshest
Differential Revision: D79554723
fbshipit-source-id: 8b0fb292948be118c7616fde1a8a84014af82de8
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52829
Changelog: [internal]
Just a small refactor to move the definitions of output paths to a specific module. We'll add more to this in a latter diff.
Reviewed By: sammy-SC
Differential Revision: D78905645
fbshipit-source-id: 011e6cec13396301dad8e76400b6f2b9e13568f0