Expand tests for the performance API#52462
Closed
rubennorte wants to merge 5 commits intofacebook:mainfrom
Closed
Conversation
Contributor
|
This pull request was exported from Phabricator. Differential Revision: D77801746 |
2b8b0d1 to
f68cdf5
Compare
rubennorte
added a commit
to rubennorte/react-native
that referenced
this pull request
Jul 7, 2025
Summary: Changelog: [internal] This adds a few more tests for `performance.getEntries`, `performance.getEntriesByName` and `performance.getEntriesByType`. Differential Revision: D77801746
Contributor
|
This pull request was exported from Phabricator. Differential Revision: D77801746 |
rubennorte
added a commit
to rubennorte/react-native
that referenced
this pull request
Jul 7, 2025
Summary: Pull Request resolved: facebook#52462 Changelog: [internal] This adds a few more tests for `performance.getEntries`, `performance.getEntriesByName` and `performance.getEntriesByType`. Differential Revision: D77801746
eb8b21d to
52e8c89
Compare
rubennorte
added a commit
to rubennorte/react-native
that referenced
this pull request
Jul 7, 2025
Summary: Changelog: [internal] This adds a few more tests for `performance.getEntries`, `performance.getEntriesByName` and `performance.getEntriesByType`. Reviewed By: huntie Differential Revision: D77801746
rubennorte
added a commit
to rubennorte/react-native
that referenced
this pull request
Jul 7, 2025
Summary: Changelog: [internal] This adds a few more tests for `performance.getEntries`, `performance.getEntriesByName` and `performance.getEntriesByType`. Reviewed By: huntie Differential Revision: D77801746
52e8c89 to
db7f8ed
Compare
Contributor
|
This pull request was exported from Phabricator. Differential Revision: D77801746 |
1 similar comment
Contributor
|
This pull request was exported from Phabricator. Differential Revision: D77801746 |
db7f8ed to
05cd6da
Compare
rubennorte
added a commit
to rubennorte/react-native
that referenced
this pull request
Jul 7, 2025
Summary: Pull Request resolved: facebook#52462 Changelog: [internal] This adds a few more tests for `performance.getEntries`, `performance.getEntriesByName` and `performance.getEntriesByType`. Reviewed By: huntie Differential Revision: D77801746
05cd6da to
6b97ba0
Compare
Contributor
|
This pull request was exported from Phabricator. Differential Revision: D77801746 |
rubennorte
added a commit
to rubennorte/react-native
that referenced
this pull request
Jul 7, 2025
Summary: Changelog: [internal] This adds a few more tests for `performance.getEntries`, `performance.getEntriesByName` and `performance.getEntriesByType`. Reviewed By: huntie Differential Revision: D77801746
6b97ba0 to
15ad514
Compare
rubennorte
added a commit
to rubennorte/react-native
that referenced
this pull request
Jul 7, 2025
Summary: Changelog: [internal] This adds a few more tests for `performance.getEntries`, `performance.getEntriesByName` and `performance.getEntriesByType`. Reviewed By: huntie Differential Revision: D77801746
15ad514 to
9e57768
Compare
rubennorte
added a commit
to rubennorte/react-native
that referenced
this pull request
Jul 7, 2025
Summary: Pull Request resolved: facebook#52462 Changelog: [internal] This adds a few more tests for `performance.getEntries`, `performance.getEntriesByName` and `performance.getEntriesByType`. Reviewed By: huntie Differential Revision: D77801746
Contributor
|
This pull request was exported from Phabricator. Differential Revision: D77801746 |
…acebook#52432) Summary: Changelog: [internal] This creates a battery of tests for `performance.mark` and `performance.measure`. For this, it was necessary to add a new method in the native module to mock the current time. Many of the tests are currently failing, as the API doesn't support all the options or behaviors defined in the spec. They're skipped here and will be re-enabled and fixed in a following diff. Reviewed By: huntie Differential Revision: D77795989
Summary: Changelog: [internal] `performance.measure` supports passing mark names as `start` and `end` options, so this fixes the Flow type before fixing the actual implementation. It also makes it so you can't specify both `end` and `duration`, enforced by the type system. Reviewed By: huntie Differential Revision: D77795991
Summary: Changelog: [internal] (This is marked as internal because this API hasn't been marked as stable yet). This fixes multiple bugs and missing features in `performance.mark` and `performance.measure`. See re-enabled tests to see the specific behaviors. Validated that performance isn't regressed by this change using the existing benchmark for `Performance` (`Performance-benchmark-itest`): * Before | (index) | Task name | Latency average (ns) | Latency median (ns) | Throughput average (ops/s) | Throughput median (ops/s) | Samples | | ------- | --------------------------------------------------------- | -------------------- | ------------------- | -------------------------- | ------------------------- | ------- | | 0 | 'mark (default)' | '5557.96 ± 0.34%' | '5459.00' | '182114 ± 0.02%' | '183184' | 179922 | | 1 | 'mark (with custom startTime)' | '5664.54 ± 1.71%' | '5518.00' | '180296 ± 0.02%' | '181225' | 176537 | | 2 | 'measure (with start and end timestamps)' | '6653.62 ± 0.94%' | '6530.00' | '152296 ± 0.02%' | '153139' | 150295 | | 3 | 'measure (with mark names)' | '6903.37 ± 0.42%' | '6790.00' | '146429 ± 0.02%' | '147275' | 144857 | | 4 | 'clearMarks' | '782.98 ± 0.04%' | '771.00' | '1287735 ± 0.01%' | '1297017' | 1277173 | | 5 | 'clearMeasures' | '792.24 ± 0.03%' | '781.00' | '1270847 ± 0.01%' | '1280410' | 1262238 | | 6 | 'mark + clearMarks' | '5883.69 ± 0.52%' | '5759.00' | '172863 ± 0.02%' | '173641' | 169962 | | 7 | 'measure + clearMeasures (with start and end timestamps)' | '7222.22 ± 0.68%' | '7021.00' | '141204 ± 0.02%' | '142430' | 138462 | | 8 | 'measure + clearMeasures (with mark names)' | '7234.53 ± 0.34%' | '7121.00' | '139600 ± 0.02%' | '140430' | 138227 | * After | (index) | Task name | Latency average (ns) | Latency median (ns) | Throughput average (ops/s) | Throughput median (ops/s) | Samples | | ------- | --------------------------------------------------------- | -------------------- | ------------------- | -------------------------- | ------------------------- | ------- | | 0 | 'mark (default)' | '5579.80 ± 0.32%' | '5479.00' | '181368 ± 0.02%' | '182515' | 179218 | | 1 | 'mark (with custom startTime)' | '5759.72 ± 0.99%' | '5648.00' | '176162 ± 0.02%' | '177054' | 173620 | | 2 | 'measure (with start and end timestamps)' | '6506.38 ± 0.34%' | '6390.00' | '155503 ± 0.02%' | '156495' | 153696 | | 3 | 'measure (with mark names)' | '6770.94 ± 0.72%' | '6620.00' | '149833 ± 0.03%' | '151057' | 147691 | | 4 | 'clearMarks' | '785.89 ± 0.07%' | '771.00' | '1291356 ± 0.01%' | '1297017' | 1272442 | | 5 | 'clearMeasures' | '777.98 ± 0.06%' | '761.00' | '1303362 ± 0.01%' | '1314060' | 1285383 | | 6 | 'mark + clearMarks' | '5995.34 ± 1.37%' | '5779.00' | '171874 ± 0.03%' | '173040' | 166797 | | 7 | 'measure + clearMeasures (with start and end timestamps)' | '7040.28 ± 0.57%' | '6830.00' | '145289 ± 0.03%' | '146413' | 142040 | | 8 | 'measure + clearMeasures (with mark names)' | '7184.43 ± 0.40%' | '6990.00' | '141809 ± 0.03%' | '143062' | 139190 | Reviewed By: huntie Differential Revision: D77795990
Summary: Changelog: [internal] This implements a significant optimization for `performance.mark` and `performance.measure`. After these changes, they take 1/3 of the time they took before. We've seen these methods show up too often in traces (in the Hermes sampling profiler) so this should significantly reduce their overhead. I found out that most of the time spent in `performance.mark` and `performance.measure` was creating the `PerformanceMark` and `PerformanceMeasure` instances returned by those methods. I applied the same playbook I did for `ReactNativeElement` (avoiding private fields and `super()` calls, which yielded these wins. * Before | (index) | Task name | Latency average (ns) | Latency median (ns) | Throughput average (ops/s) | Throughput median (ops/s) | Samples | | ------- | --------------------------------------------------------- | -------------------- | ------------------- | -------------------------- | ------------------------- | ------- | | 0 | 'mark (default)' | '5579.80 ± 0.32%' | '5479.00' | '181368 ± 0.02%' | '182515' | 179218 | | 1 | 'mark (with custom startTime)' | '5759.72 ± 0.99%' | '5648.00' | '176162 ± 0.02%' | '177054' | 173620 | | 2 | 'measure (with start and end timestamps)' | '6506.38 ± 0.34%' | '6390.00' | '155503 ± 0.02%' | '156495' | 153696 | | 3 | 'measure (with mark names)' | '6770.94 ± 0.72%' | '6620.00' | '149833 ± 0.03%' | '151057' | 147691 | | 4 | 'clearMarks' | '785.89 ± 0.07%' | '771.00' | '1291356 ± 0.01%' | '1297017' | 1272442 | | 5 | 'clearMeasures' | '777.98 ± 0.06%' | '761.00' | '1303362 ± 0.01%' | '1314060' | 1285383 | | 6 | 'mark + clearMarks' | '5995.34 ± 1.37%' | '5779.00' | '171874 ± 0.03%' | '173040' | 166797 | | 7 | 'measure + clearMeasures (with start and end timestamps)' | '7040.28 ± 0.57%' | '6830.00' | '145289 ± 0.03%' | '146413' | 142040 | | 8 | 'measure + clearMeasures (with mark names)' | '7184.43 ± 0.40%' | '6990.00' | '141809 ± 0.03%' | '143062' | 139190 | * After | (index) | Task name | Latency average (ns) | Latency median (ns) | Throughput average (ops/s) | Throughput median (ops/s) | Samples | | ------- | --------------------------------------------------------- | -------------------- | ------------------- | -------------------------- | ------------------------- | ------- | | 0 | 'mark (default)' | '1678.19 ± 0.73%' | '1633.00' | '607139 ± 0.01%' | '612370' | 595882 | | 1 | 'mark (with custom startTime)' | '1920.23 ± 1.30%' | '1843.00' | '538217 ± 0.01%' | '542594' | 520772 | | 2 | 'measure (with start and end timestamps)' | '2651.72 ± 0.94%' | '2554.00' | '388312 ± 0.02%' | '391543' | 377114 | | 3 | 'measure (with mark names)' | '2815.84 ± 0.75%' | '2744.00' | '362303 ± 0.02%' | '364431' | 355134 | | 4 | 'clearMarks' | '743.82 ± 0.06%' | '731.00' | '1363190 ± 0.01%' | '1367989' | 1344417 | | 5 | 'clearMeasures' | '776.69 ± 0.07%' | '761.00' | '1306563 ± 0.01%' | '1314060' | 1287512 | | 6 | 'mark + clearMarks' | '2043.97 ± 1.26%' | '1973.00' | '504750 ± 0.01%' | '506842' | 489801 | | 7 | 'measure + clearMeasures (with start and end timestamps)' | '3048.39 ± 0.87%' | '2965.00' | '335285 ± 0.02%' | '337268' | 328042 | | 8 | 'measure + clearMeasures (with mark names)' | '3132.75 ± 0.80%' | '3065.00' | '324365 ± 0.02%' | '326264' | 319209 | Reviewed By: huntie Differential Revision: D77790874
Summary: Changelog: [internal] This adds a few more tests for `performance.getEntries`, `performance.getEntriesByName` and `performance.getEntriesByType`. Reviewed By: huntie Differential Revision: D77801746
9e57768 to
005aacc
Compare
rubennorte
added a commit
to rubennorte/react-native
that referenced
this pull request
Jul 7, 2025
Summary: Changelog: [internal] This adds a few more tests for `performance.getEntries`, `performance.getEntriesByName` and `performance.getEntriesByType`. Reviewed By: huntie Differential Revision: D77801746
Contributor
|
This pull request was exported from Phabricator. Differential Revision: D77801746 |
rubennorte
added a commit
to rubennorte/react-native
that referenced
this pull request
Jul 7, 2025
Summary: Changelog: [internal] This adds a few more tests for `performance.getEntries`, `performance.getEntriesByName` and `performance.getEntriesByType`. Reviewed By: huntie Differential Revision: D77801746
Contributor
|
This pull request has been merged in feeef97. |
kikoso
pushed a commit
to kikoso/react-native
that referenced
this pull request
Aug 26, 2025
Summary: Pull Request resolved: facebook#52462 Changelog: [internal] This adds a few more tests for `performance.getEntries`, `performance.getEntriesByName` and `performance.getEntriesByType`. Reviewed By: huntie Differential Revision: D77801746 fbshipit-source-id: 42f80c4e2b787c455b149ee38d071511181532b0
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary:
Changelog: [internal]
This adds a few more tests for
performance.getEntries,performance.getEntriesByNameandperformance.getEntriesByType.Differential Revision: D77801746