Commit Graph

6 Commits

Author SHA1 Message Date
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
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
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 bfe31bad1f Small refactor of how Fantom configs are formatted (#52826)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52826

Changelog: [internal]

This is just an intermediate change to simplify how we format Fantom configs, so we can extend it to use other formatting formats (e.g.: short format to use in file names).

Reviewed By: lenaic

Differential Revision: D78924771

fbshipit-source-id: 4886a800a6836dc6a66539b1df079adb6c9c52e1
2025-07-25 05:47:35 -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