Commit Graph

18 Commits

Author SHA1 Message Date
Rubén Norte e14b5f1d6f Move default export of PerformanceObserver to named export (#45874)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45874

Changelog: [internal]

Move default export of `PerformanceObserver` to named export.

Reviewed By: sammy-SC

Differential Revision: D60597779

fbshipit-source-id: 39f82c1903aa32a5318b112cbb03b63e4e6d2fc0
2024-08-02 10:19:49 -07:00
Rubén Norte 64c4e385cb Implement Long Tasks API for PerformanceObserver (#45473)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45473

This is a basic implementation of the Long Tasks API (https://w3c.github.io/longtasks/).

It detects and reports long tasks when using the Event Loop (in the modern RuntimeScheduler) when a new feature flag for this purpose is enabled.

This doesn't include attribution information at the moment.

Changelog: [internal]

Reviewed By: sammy-SC

Differential Revision: D55491870

fbshipit-source-id: e1ccad9cc6a35073b31230a8cf3a4660ab9a043d
2024-07-18 05:08:58 -07:00
Rubén Norte 0f43f86035 Add example of Event Timing API in RNTester examples (#43848)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43848

Changelog: [internal]

This makes it easier to see the behavior of the new Event Timing API in RN.

Reviewed By: sammy-SC

Differential Revision: D55646393

fbshipit-source-id: 441fed789a980211783f04095303a139e7b08483
2024-04-09 07:51:03 -07:00
Rubén Norte 2f1643dc0c Remove unnecessary wrapper from Performance/PerformanceObserver examples screen in RNTester (#43706)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43706

Changelog: [internal]

Just a small improvement of the UI for the Performance API examples in RNTester.

Reviewed By: christophpurrer

Differential Revision: D55489933

fbshipit-source-id: a1fe4f4962227941827f02cf18a0d4685e18f006
2024-04-02 06:27:05 -07:00
Rubén Norte 636289c441 Add example of performance.mark and performance.measure in RNTester (#43704)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43704

Changelog: [internal]

Adding examples of the rest of APIs in `Performance`/`PerformanceObserver` starting with marks and measures.

Reviewed By: rshest

Differential Revision: D55477746

fbshipit-source-id: 965796b6a97dc527192093e3c93af837a4d5b714
2024-04-02 06:27:05 -07:00
Rubén Norte fa47c27eae Support dark theme in PerformanceApiExample in RNTester (#43705)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43705

Changelog: [internal]

Reviewed By: rshest

Differential Revision: D55477744

fbshipit-source-id: 6960366330343678e493dd54292bda7df5a61e6a
2024-04-02 06:27:05 -07:00
Rubén Norte b97f3e779a Move Web performance APIs to private directory (#42769)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42769

Changelog: [internal]

These APIs are not currently enabled in OSS, so moving the modules should be safe and not considered a breaking change.

Reviewed By: NickGerleman

Differential Revision: D53267565

fbshipit-source-id: edd3daa7c5043e44e5fd4b1af074093ed3ef4152
2024-02-14 03:58:10 -08:00
Rubén Norte c7bef93af0 Rename performance.reactNativeStartupTiming as performance.rnStartupTiming (#42762)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42762

This renames `performance.reactNativeStartupTiming` as `performance.rnStartupTiming` to align with the recommended vendor prefix for React Native.

This API is still private, so it's safe to rename.

Changelog: [internal]

Reviewed By: javache

Differential Revision: D53264515

fbshipit-source-id: 6e7a222901071594cac0ca8a0ac78e56e60ab132
2024-01-31 07:16:21 -08:00
Moti Zilberman d6e0bc714a Enable lint/sort-imports everywhere (#41334)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41334

TSIA.

Changelog: [Internal]

Reviewed By: robhogan

Differential Revision: D51025812

fbshipit-source-id: e10d437be775a6b80946483aa96460f34927f870
2023-11-06 12:59:38 -08:00
Xin Chen 17f957aadd Update startup perf api to accept undefined/null values (#38323)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38323

This change makes the returned values from `performance.reactNativeStartupTiming` to accept null or undefined. This is done as some platforms may not have certain startup timing information, and as a default value, it's discussed that null/undefined is better than zero.

- Use `unorderedMap` instead of custom timing object for the C++ native module return value
- Use `std::nan` as initialized value for unset doubles
- Update examples to reflect the latest changes

Changelog:
[General][Internal] - Make the return values for `reactNativeStartupTiming` possible to be null or undefined

Reviewed By: mdvacca

Differential Revision: D43885535

fbshipit-source-id: f35292f2e9cdf98750d0d80b9e3bcdcddc560fb7
2023-08-17 12:35:57 -07:00
Xin Chen 50638714f5 Add init react runtime start time in performance API (#38858)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38858

Pull Request resolved: https://github.com/facebook/react-native/pull/38328

This diff adds the two extra markers `initializeRuntimeStart` and `initializeRuntimeEnd` to the startup performance API. The runtime start time matches the existing android marker `GET_REACT_INSTANCE_MANAGER_START`, which is the first marker we have on the RN android app.

Changelog:
[Android][Added] - Add `performance.reactNativeStartupTiming.initializeRuntimeStart` and `performance.reactNativeStartupTiming.initializeRuntimeEnd` API

Reviewed By: rshest

Differential Revision: D47941110

fbshipit-source-id: d7e65f822f1c60a46dccacc8fd5bba84174f9f31
2023-08-15 18:51:07 -07:00
Josh Leibsly ed640183e5 Revert D43863974: Add init react runtime start time in performance API
Differential Revision:
D43863974

Original commit changeset: 277d35e14dbb

Original Phabricator Diff: D43863974

fbshipit-source-id: 87fc2bb88fa25601028643e7c15a7984a30b9d43
2023-07-28 08:28:02 -07:00
Xin Chen 10e8b3538f Add init react runtime start time in performance API (#38328)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38328

This diff adds the two extra markers `initializeRuntimeStart` and `initializeRuntimeEnd` to the startup performance API. The runtime start time matches the existing android marker `GET_REACT_INSTANCE_MANAGER_START`, which is the first marker we have on the RN android app.

Changelog:
[Android][Added] - Add `performance.reactNativeStartupTiming.initializeRuntimeStart` and` `performance.reactNativeStartupTiming.initializeRuntimeEnd` API

Reviewed By: mdvacca

Differential Revision: D43863974

fbshipit-source-id: 277d35e14dbb5e3def8d440b717b3cf0215b4f47
2023-07-27 16:14:58 -07:00
Nick Gerleman a999f0d2f3 Cleanup RNTesterExampleFilter/RNTesterPage/RNTesterBlock Spacers
Summary:
Right now RNTestePage either adds a large spacer to the end of content, unless `noSpacer` is added. But with `noSpacer`, scrolling content may not be reachable because we are putting padding on the wrong container.

This fixes that and removes a few cases where we had multi hundred px empty space in favor of uniformly taking up the parent, and a 10px padding. This also moves the constant margin at the top of RNTesterBlock to the container, so that in the E2E container we can save the 30px.

Changelog:
[Internal]

Reviewed By: javache

Differential Revision: D44197303

fbshipit-source-id: 8dc67f3588bc28316e2fee8d25a0bc59995f1728
2023-03-20 11:14:16 -07:00
TatianaKapos 6a395cb2d7 Change PerformanceApiExample to use ModulePathing (#36478)
Summary:
Recent integration from Windows brought in PerformanceApiExample that uses relative pathing to access react-native library. This causes us to have to override the file since our file structure is different. https://github.com/microsoft/react-native-windows/issues/11373

This PR changes the example to use module pathing instead.

## Changelog

[GENERAL] [CHANGED] - Change PerformanceApiExample to use ModulePathing

Pull Request resolved: https://github.com/facebook/react-native/pull/36478

Test Plan: Tested and passed Windows tests

Reviewed By: rshest

Differential Revision: D44089501

Pulled By: javache

fbshipit-source-id: 99993a4f81556b4fef7c5d15af26b20df960ebf9
2023-03-15 05:47:17 -07:00
Xin Chen f4e56fdf19 Refactor performance memory API implementation
Summary:
This diff refactors performance memory API and the RN Tester example.

- The returned value from C++ is number, so no need to cast
- Reuse `MemoryInfo` in RNTester example

Changelog:
[General][Internal] - Code refactor for performance memory API implementation

Reviewed By: rubennorte

Differential Revision: D43523878

fbshipit-source-id: 37d1f6a829a8eac45f7e3791ad36be0c199c6041
2023-03-07 18:32:20 -08:00
Xin Chen c1023c73b0 Add performance.reactNativeStartupTiming API
Summary:
This diff adds the `performance.reactNativeStartupTiming` API to the performance global object for RN. This property does not exist in web, and we are free to make up our own list of properties in the startup metrics to track RN app startup process. In our case, we have the following six properties to begin with (we may extend and add more to this list in the future):

```
- `(start|end)Time`: The time ‘zero’ for the startup timing and the end of app startup. RN has no knowledge of app start time, which will be provided by the platform. The `endTime` will be the time when the first JS bundle finishes executing (Note that RN supports multiple JS bundles, which can be loaded async)
  - `executeJavaScriptBundleEntryPoint(Start|End)`: The time for RN to execute the JS entry point (and finish all sync job)

```

Changelog:
[General][Added] - Add new JS performance API to support getting RN app startup timings

Reviewed By: rshest

Differential Revision: D43326564

fbshipit-source-id: 7b4c7cae70ff64ba1714a1630cd5e183df6c06b0
2023-03-02 20:04:42 -08:00
Xin Chen d528fe28a6 Add performance.memory API example to RNTester
Summary:
Add performance API example to RN tester, start with the `performance.memory` API.

- Update `RNTesterList` file for both android and ios

Changelog:
[General][Internal] - Add `performance.memory` API example to RNTester

Reviewed By: rshest

Differential Revision: D43326565

fbshipit-source-id: adeb18ce9f1f90d9e9ecf66b533307028bc02df8
2023-02-23 09:14:10 -08:00