Commit Graph

92 Commits

Author SHA1 Message Date
Andrew Datsenko 10a46f7b52 Add support for JS coverage (#53410)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53410

Changelog: [Internal]
Adding babel-istanbul-plugin to instrument bundle code with coverage reporting.
Metro will transform source code only when coverage flag is set up globally in jest.
Coverage map is then provided by runner as part of test result.

Reviewed By: sammy-SC

Differential Revision: D80716433

fbshipit-source-id: 3831f227f8793f874f0d2366759bb6916e747c72
2025-09-04 07:19:56 -07:00
Andrew Datsenko 42b94fc709 Add babel-plugin-istanbul for code covearage (#53413)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53413

Changelog: [Internal]
Add dependency on istanbul plugin so we can collect code coverage.

Reviewed By: christophpurrer

Differential Revision: D80723825

fbshipit-source-id: bf0ac0e49e12ea1b01f72c11362019ef68e09ff9
2025-08-25 10:45:16 -07:00
Marco Wang da9136f587 Turn on null strict comparison check for xplat js (#53379)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53379

X-link: https://github.com/facebook/react/pull/34240

Changelog: [Internal]

Reviewed By: SamChou19815

Differential Revision: D80648362

fbshipit-source-id: cc47ae207f29a3ddb68bc0e029b8773f89503c52
2025-08-21 16:46:23 -07:00
Jakub Piasecki 776fca1e7c Change hermes atrifact names (#53094)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53094

Changelog: [General][Changed] - Changed names of hermes binaries

Reviewed By: cipolleschi, cortinico

Differential Revision: D79163127

fbshipit-source-id: 54be34ba1f6ce90067768394ca9a6e9c4048be90
2025-08-21 04:00:04 -07:00
Rubén Norte 78f089906c Use React Native built-in definitions for Event and EventTarget in Fantom (#53362)
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
2025-08-20 06:01:22 -07:00
Nivaldo Bondança d1a1020a4a Codemod format for trailing commas change
Reviewed By: VladimirMakaev

Differential Revision: D80576929

fbshipit-source-id: 1310f77f5d9d489b780b14875454ebda7f7adfc9
2025-08-19 18:15:18 -07:00
Marco Wang 8351a5d186 Pre-Suppress errors for xplat/js for general strict comparison in non-generated files (#53342)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53342

Commands

```
scripts/flow/tool add-comments --comment 'Error discovered during Constant Condition roll out. See https://fburl.com/workplace/4oq3zi07.' .
```
```
arc f
```

drop-conflicts

Reviewed By: SamChou19815

Differential Revision: D80487235

fbshipit-source-id: 9e7c1a2641ddc0da0400fa1aff598b112a0434d5
2025-08-19 01:09:22 -07:00
Sam Zhou cf664c65e2 Standardize subtyping error code into incompatible-type in react native and metro (#53312)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53312

Changelog: [Internal]

Reviewed By: jbrown215

Differential Revision: D80400976

fbshipit-source-id: 196af69c0b9621b2a2675b232406639773e04933
2025-08-18 09:04:31 -07:00
Rubén Norte 6b4af382c2 Apply better default options in benchmarks (#53320)
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
2025-08-18 08:57:52 -07:00
Rubén Norte 219fc99e99 Rename minDuration as minTestExecutionTime for clarity (#53321)
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
2025-08-18 08:57:52 -07:00
Rubén Norte 6c37b5b682 Improve typing of benchmark functions (#53322)
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
2025-08-18 08:57:52 -07:00
Rubén Norte 180996683b Print information about benchmark duration (#53323)
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
2025-08-18 08:57:52 -07:00
Samuel Susla 3a3e3b884c Move C++ Animated to ReactCommon (#53278)
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
2025-08-18 04:13:13 -07:00
Ruslan Shestopalyuk e3183739bb Options to run Fantom with address and thread sanitizers enabled (#53300)
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
2025-08-15 08:12:04 -07:00
Rubén Norte 38e1e0de53 Use string references in Fantom native module (#53274)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53274

Changelog: [internal]

Minor refactor

Reviewed By: rshest

Differential Revision: D80255982

fbshipit-source-id: 703f32a1edf5c225b0b07b3c519932ebe167b2c8
2025-08-14 06:19:00 -07:00
Rubén Norte e8bf982bac Support overriddenDuration in Fantom benchmarks (#53250)
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
2025-08-13 10:14:21 -07:00
Rubén Norte 4ee326f52c Add documentation for JS memory profiler in Fantom (#53226)
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
2025-08-12 11:08:08 -07:00
Rubén Norte 90804fd088 Add documentation for JS sampling profiler in Fantom (#53227)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53227

Changelog: [internal]

This adds docs for the new JS sampling profiler in Fantom

Reviewed By: lenaic

Differential Revision: D80090284

fbshipit-source-id: 0f7fa498cf141a51ac6fda331522945d42fc494d
2025-08-12 11:08:08 -07:00
Rubén Norte e2035379b6 Add documentation for debugging in Fantom (#53228)
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
2025-08-12 11:08:08 -07:00
Rubén Norte 0bf7721862 Use Jest naming for test regex in Fantom docs (#53229)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53229

Changelog: [internal]

Tiny change to align with how Jest refers to this argument in its docs: https://jestjs.io/docs/cli#jest-regexfortestfiles

Reviewed By: lenaic

Differential Revision: D80090285

fbshipit-source-id: 86a4ad75078eb9b7575fca9659cc1a2e678f7a0a
2025-08-12 11:08:08 -07:00
Ruslan Shestopalyuk 641a79dc51 Improve benchmark comparison printout ("slower"->"faster") (#53221)
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
2025-08-12 06:56:14 -07:00
Rubén Norte 65974e938c Add support for JS debugging in Fantom (#53215)
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
2025-08-12 05:41:11 -07:00
Rubén Norte 9c201c0f8f Automatically inject debugger statements in tests in preparation for debug mode (#53205)
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
2025-08-12 05:41:11 -07:00
Rubén Norte e0b22e1ebf Rename global variable with Metro server for Fantom (#53202)
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
2025-08-12 05:41:11 -07:00
Rubén Norte 6fb0072f01 Refactor logic to find available port for Metro in Fantom (#53204)
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
2025-08-12 05:41:11 -07:00
Andrew Datsenko 6738dbcc7e Generalize accessibility testing (#53182)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53182

Changelog: [Internal]
Move accessibility tests into reusable test suite.

Reviewed By: rshest

Differential Revision: D79897200

fbshipit-source-id: d98ebc7d16e7fd5c3c81086df4eec07dfdcb2fb0
2025-08-11 13:59:43 -07:00
Zeya Peng 5517c046ab Cache result when RenderOutput::render() is called (#53112)
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
2025-08-08 10:54:05 -07:00
Andrew Datsenko 8363a4c515 Add static methods tests (#53087)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53087

Changelog: [Internal]
As title

Reviewed By: lenaic

Differential Revision: D79665922

fbshipit-source-id: 024c10960a59e1332aacf2411a68ca85c17142db
2025-08-08 06:00:58 -07:00
Rubén Norte 2f33eece41 Fix retry logic in Fantom when requesting bundles from Metro (#53161)
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
2025-08-08 04:22:16 -07:00
Ruslan Shestopalyuk 5fc23d7c62 Add type-safe API for passing around benchmark results (#53143)
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
2025-08-07 10:46:26 -07:00
Ruslan Shestopalyuk 77ee24ddce Print benchmark comparison results in a tabular format (#53097)
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
2025-08-07 08:11:32 -07:00
Rubén Norte 789fc57254 Improve API to take JS heap snapshots in Fantom (#53071)
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
2025-08-06 05:40:02 -07:00
Rubén Norte 2187f653f6 Improve filenames of JS sampling profiler traces (#53069)
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
2025-08-06 05:40:02 -07:00
Ruslan Shestopalyuk 743db63570 Fix logspam when there is no benchmarking results (#53091)
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
2025-08-06 05:32:11 -07:00
Ruslan Shestopalyuk 8ef39b491c Implement benchmark comparison of different feture flag configurations (#52925)
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
2025-08-05 08:34:35 -07:00
Rubén Norte b903ed7940 Add support for JS sampling profiler (#52827)
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
2025-08-05 05:36:26 -07:00
Rubén Norte 064750daa8 Improve type safety of constants passed from runner to runtime (#53034)
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
2025-08-05 05:36:26 -07:00
Rubén Norte f2e72c3859 Implement HighResTimeStamp mocking in Fantom (#53019)
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
2025-08-04 11:21:03 -07:00
Rubén Norte 2016118aeb Centralize path definitions for Fantom builds and move to .out (#52829)
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
2025-08-04 05:56:51 -07:00
Rubén Norte 6760383470 Create source maps for Fantom lazily (#52786)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52786

Changelog: [internal]

It takes around 300ms to generate each source map file, and we really only need them if tests throw errors. Requesting source maps also increases contention to access the Metro server from each test worker.

This refactors the code so we only generate them in that case, which could save up to 20s in test execution time.

Reviewed By: rshest

Differential Revision: D78807672

fbshipit-source-id: af9f0f0377ddcf05014b5aca0b28db938dfb4ce2
2025-08-04 05:56:51 -07:00
Rubén Norte 5c2b9eda69 Refactor runner to use a single instance of Metro for each run (#52777)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52777

Changelog: [internal]

This significantly speeds up test execution in Fantom (around 2x in OSS and 6x at Meta) by starting a Metro server before all tests runs and reusing it across all tests to build test bundles, instead of spinning up a new Metro instance every time we run each test.

The architecture change (also considering the previous change in buck prebuilds) looks like this:
{F1980689532}

This is how is impacts execution times (compared to the baseline):
* OSS
  * Before: 62s {F1980564286}
  * After: 30s (**2x faster**) {F1980564265}

Reviewed By: andrewdacenko

Differential Revision: D78741903

fbshipit-source-id: b209f88925e49cc2a2067e8df9b7fa9a29b4c8d2
2025-08-04 05:56:51 -07:00
Rubén Norte 3ecd48fa91 Refactor Fantom runner to decouple compilation from execution to speed up test execution (#52758)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52758

Changelog: [internal]

This is a change to how Fantom tests run in Meta infra via Buck.

After this, the biggest opportunity will be optimizing how we generate bundles with Metro.

Reviewed By: christophpurrer

Differential Revision: D78672863

fbshipit-source-id: 1152907f3ba60e7d2e48bcc588f3c07aef7bb393
2025-08-04 05:56:51 -07:00
Rubén Norte 4289cff268 Add isOSS to Fantom constants (#53010)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53010

Changelog: [internal]

Exposing this value so we can disable some tests in some scenarios in a following this.

Reviewed By: cipolleschi

Differential Revision: D79510481

fbshipit-source-id: 632d9a008943ed40c24878b5561065b6ede1d689
2025-08-04 03:54:58 -07:00
Sam Zhou c43a39925f Replace $FlowIssue with $FlowFixMe (#52976)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52976

Changelog: [Internal]

Reviewed By: GijsWeterings

Differential Revision: D79400163

fbshipit-source-id: b0c4f10b18b99550bdf95be620187f011b62f2f7
2025-08-01 07:50:00 -07:00
Devan Buggay 15373218ec Add granular control with pragma modes (#52894)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52894

Adds the following boolean pragma modes for more granular control:

```
fantom_native_opt true|false
fantom_js_opt true|false
fantom_js_bytecode true|false
```

Previously these were all set together with `fantom_mode`. These modes are mutually exclusive with `fantom_mode`.

Changelog: [Internal]

Reviewed By: rubennorte

Differential Revision: D79151687

fbshipit-source-id: 59c3f20bccb570c0293ffd037609946a1a9bbb8f
2025-07-30 14:22:22 -07:00
Devan Buggay 6d51bce9ed Refactor native/js modes (#52822)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52822

Refactors underlying modes by adding `isNativeOpt`, `isJsOpt`, and `isJsBytecode` to allow for more granular control in a future diff.

### View ###

| (index) | Task name                                                 | Latency average (ns)   | Latency median (ns)       | Throughput average (ops/s) | Throughput median (ops/s) | Samples |
| ------- | --------------------------------------------------------- | ---------------------- | ------------------------- | -------------------------- | ------------------------- | ------- |
| 0       | 'render 100 uncollapsable views'                          | '23005778.16 ± 0.53%'  | '22877194.50 ± 11607.50'  | '43 ± 0.50%'               | '44'                      | 64      |
| 1       | 'render 1000 uncollapsable views'                         | '271276451.70 ± 0.61%' | '268378201.00 ± 9925.00'  | '4 ± 0.59%'                | '4'                       | 64      |
| 2       | 'render 100 views with large amount of props and styles'  | '47580650.91 ± 1.21%'  | '47212012.00 ± 2979.00'   | '21 ± 0.89%'               | '21'                      | 64      |
| 3       | 'render 1000 views with large amount of props and styles' | '521237370.22 ± 1.09%' | '516142815.00 ± 41682.00' | '2 ± 0.84%'                | '2'                       | 64      |
| 4       | 'render 1500 views with large amount of props and styles' | '828143691.48 ± 0.94%' | '824723257.50 ± 11331.50' | '1 ± 0.73%'                | '1'                       | 64      |

### View (mode 🚀, jsMode 🚀, bytecode) ###

| (index) | Task name                                                 | Latency average (ns)   | Latency median (ns)        | Throughput average (ops/s) | Throughput median (ops/s) | Samples |
| ------- | --------------------------------------------------------- | ---------------------- | -------------------------- | -------------------------- | ------------------------- | ------- |
| 0       | 'render 100 uncollapsable views'                          | '4051033.45 ± 2.01%'   | '3876618.00'               | '251 ± 1.29%'              | '258'                     | 247     |
| 1       | 'render 1000 uncollapsable views'                         | '86134420.23 ± 1.38%'  | '85815369.50 ± 281477.50'  | '12 ± 1.38%'               | '12'                      | 64      |
| 2       | 'render 100 views with large amount of props and styles'  | '13921817.92 ± 2.57%'  | '13474963.50 ± 4977.50'    | '72 ± 1.62%'               | '74'                      | 72      |
| 3       | 'render 1000 views with large amount of props and styles' | '182664526.31 ± 0.74%' | '181872565.00 ± 10281.00'  | '5 ± 0.73%'                | '5'                       | 64      |
| 4       | 'render 1500 views with large amount of props and styles' | '313110386.45 ± 1.13%' | '307934163.50 ± 156920.50' | '3 ± 1.07%'                | '3'                       | 64      |

Changelog: [Internal]

Reviewed By: rubennorte

Differential Revision: D78912257

fbshipit-source-id: 16fd0301af98159dbb9818cb8092bd4416ef2559
2025-07-30 14:22:22 -07:00
Alex Hunt a3bf989450 Implement reporting InteractionEntry live metrics to runtime (#52839)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52839

**Context**

Experimental V2 Performance Monitor prototype, beginning by bringing the [Interaction to Next Paint (INP)](https://web.dev/articles/inp) metric to React Native.

**This diff**

Adds and configures a `CdpMetricsReporter` class to report `InteractionEntry` live metrics over CDP via the `"__chromium_devtools_metrics_reporter"` runtime binding.

**Notes**

- Introduces a new `react/performance/cdpmetrics` package, and a listener API on `PerformanceEntryReporter` (both to avoid a `jni` dependency in `react/performance/timeline`).

Changelog: [Internal]

Reviewed By: rubennorte

Differential Revision: D78904748

fbshipit-source-id: c75971aba43d9929912b3d1dba7576c2a2342214
2025-07-30 07:13:58 -07:00
Rubén Norte 797d14da9e Expose types for benchmark options (#52875)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52875

Changelog: [internal]

This simplifies typing tests.

Reviewed By: christophpurrer

Differential Revision: D79086359

fbshipit-source-id: 683a713e0182f18c9b26e515921d17cf7873aa06
2025-07-28 10:02:25 -07:00
Rubén Norte 082db1e0a7 Remove static_hermes_staging variant for Fantom tests (#52861)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52861

Changelog: [internal]

We added this mode recently to support all local Hermes variants, but this doubles the number of build type combinations which regresses test execution time and give us little benefit, so we're removing it.

Reviewed By: rshest

Differential Revision: D79080370

fbshipit-source-id: e1b536427acb98ec01edfd44829e2fef9be9b18d
2025-07-28 06:35:49 -07:00
Rubén Norte 20fc2618d0 Force every output to have a different filename in the same run (#52863)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52863

Changelog: [internal]

We're seeing some issues in stress runs for Fantom tests in optimized mode, failing when compiling the bytecode with Hermes. The specific error in the Hermes compiler isn't clear, but this started failing when we changed the folders for output. It's possible that it's due to race conditions in stress runs, where multiple workers are attempting to compile in the same locations.

This forces every output in every runner to be in a different file to prevent these possible collisions.

Reviewed By: rshest

Differential Revision: D79084242

fbshipit-source-id: b4540e2e6c5378c7fc8630ac2fea674e0ef78a14
2025-07-28 06:35:49 -07:00