Skip to content

Conversation

@rubennorte
Copy link
Contributor

Summary:
Changelog: [internal]

This refactors some code in the performance API and Perfetto to avoid doing unnecessary work when not tracing (e.g.: string manipulation for tracks).

It also reduces the cost of logging marks/measures to tracing backends if not actively tracing (e.g.: moving the check to outside the lock).

Differential Revision: D69246772

@facebook-github-bot facebook-github-bot added CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. p: Facebook Partner: Facebook Partner labels Feb 24, 2025
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D69246772

rubennorte added a commit to rubennorte/react-native that referenced this pull request Feb 24, 2025
…k#49639)

Summary:

Changelog: [internal]

This refactors some code in the performance API and Perfetto to avoid doing unnecessary work when not tracing (e.g.: string manipulation for tracks).

It also reduces the cost of logging marks/measures to tracing backends if not actively tracing (e.g.: moving the check to outside the lock).

Differential Revision: D69246772
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D69246772

Summary:

Changelog: [internal]

This adds a basic benchmark for different use cases of the `performance` API.

Baseline:
| (index) | Task name                                                 | Latency average (ns) | Latency median (ns) | Throughput average (ops/s) | Throughput median (ops/s) | Samples |
| ------- | --------------------------------------------------------- | -------------------- | ------------------- | -------------------------- | ------------------------- | ------- |
| 0       | 'mark (default)'                                          | '5692.08 ± 0.33%'    | '5590.00'           | '177735 ± 0.02%'           | '178891'                  | 175683  |
| 1       | 'mark (with custom startTime)'                            | '5775.21 ± 0.27%'    | '5690.00'           | '174880 ± 0.02%'           | '175747'                  | 173154  |
| 2       | 'measure (with start and end timestamps)'                 | '6842.61 ± 0.35%'    | '6730.00'           | '147672 ± 0.02%'           | '148588'                  | 146144  |
| 3       | 'measure (with mark names)'                               | '6828.01 ± 0.75%'    | '6700.00'           | '148371 ± 0.02%'           | '149254'                  | 146456  |
| 4       | 'clearMarks'                                              | '817.04 ± 0.03%'     | '800.00'            | '1233054 ± 0.01%'          | '1250000'                 | 1223933 |
| 5       | 'clearMeasures'                                           | '835.59 ± 0.03%'     | '820.00'            | '1203121 ± 0.01%'          | '1219512'                 | 1196758 |
| 6       | 'mark + clearMarks'                                       | '6137.42 ± 1.32%'    | '5920.00'           | '167661 ± 0.02%'           | '168919'                  | 162935  |
| 7       | 'measure + clearMeasures (with start and end timestamps)' | '7353.85 ± 0.60%'    | '7200.00'           | '138196 ± 0.02%'           | '138889'                  | 135984  |
| 8       | 'measure + clearMeasures (with mark names)'               | '7342.93 ± 0.66%'    | '7170.00'           | '138726 ± 0.02%'           | '139470'                  | 136186  |

Reviewed By: bgirard

Differential Revision: D66926182
…k#49639)

Summary:

Changelog: [internal]

This refactors some code in the performance API and Perfetto to avoid doing unnecessary work when not tracing (e.g.: string manipulation for tracks).

It also reduces the cost of logging marks/measures to tracing backends if not actively tracing (e.g.: moving the check to outside the lock).

Reviewed By: bgirard

Differential Revision: D69246772
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D69246772

@facebook-github-bot facebook-github-bot added the Merged This PR has been merged. label Feb 24, 2025
@facebook-github-bot
Copy link
Contributor

This pull request has been merged in 8989bc2.

ghost pushed a commit to discord/react-native that referenced this pull request Jul 29, 2025
…k#49639)

Summary:
Pull Request resolved: facebook#49639

Changelog: [internal]

This refactors some code in the performance API and Perfetto to avoid doing unnecessary work when not tracing (e.g.: string manipulation for tracks).

It also reduces the cost of logging marks/measures to tracing backends if not actively tracing (e.g.: moving the check to outside the lock).

Reviewed By: bgirard

Differential Revision: D69246772

fbshipit-source-id: 141a13f609f12be7ab8ca00f7aa1892b34770bbb
ghost pushed a commit to discord/react-native that referenced this pull request Jul 29, 2025
…k#49639)

Summary:
Pull Request resolved: facebook#49639

Changelog: [internal]

This refactors some code in the performance API and Perfetto to avoid doing unnecessary work when not tracing (e.g.: string manipulation for tracks).

It also reduces the cost of logging marks/measures to tracing backends if not actively tracing (e.g.: moving the check to outside the lock).

Reviewed By: bgirard

Differential Revision: D69246772

fbshipit-source-id: 141a13f609f12be7ab8ca00f7aa1892b34770bbb
gabrieldonadel pushed a commit to gabrieldonadel/react-native that referenced this pull request Aug 12, 2025
…k#49639)

Summary:
Pull Request resolved: facebook#49639

Changelog: [internal]

This refactors some code in the performance API and Perfetto to avoid doing unnecessary work when not tracing (e.g.: string manipulation for tracks).

It also reduces the cost of logging marks/measures to tracing backends if not actively tracing (e.g.: moving the check to outside the lock).

Reviewed By: bgirard

Differential Revision: D69246772

fbshipit-source-id: 141a13f609f12be7ab8ca00f7aa1892b34770bbb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported Merged This PR has been merged. p: Facebook Partner: Facebook Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants