Commit Graph

11 Commits

Author SHA1 Message Date
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
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
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 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 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 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
Rubén Norte 342b88d0d3 Create new environment variable to force running benchmarks in test mode (#52759)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52759

Changelog: [internal]

This introduces a new environment variable for Fantom to disable benchmarks (`FANTOM_FORCE_TEST_MODE`), without having to run in CI mode.

Reviewed By: rshest

Differential Revision: D78672864

fbshipit-source-id: ef445bd8b36703594658529da2436c75d5b87179
2025-07-23 04:41:42 -07:00
Rubén Norte 29704b1f02 Add support for Static Hermes staging in Fantom (#52105)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52105

Changelog: [internal]

I just learnt there's a Hermes variant that we don't support (staging) so this adds support for it.

Reviewed By: christophpurrer

Differential Revision: D76897715

fbshipit-source-id: 3113edde3c785d71ad4a57dd435f16e13ab46976
2025-06-18 09:36:36 -07:00
Tim Yung d6f29c8afd RN: Move {packages => private}/react-native-fantom (#51938)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51938

Moves `packages/react-native-fantom` to `private/react-native-fantom`.

Changelog:
[Internal]

Reviewed By: huntie

Differential Revision: D76368959

fbshipit-source-id: 8d62f792229c10cd108dc849e8629d3174dc72c1
2025-06-11 23:49:51 -07:00