Skip to content

Fix measure not using the last reported mark with a given name#43703

Closed
rubennorte wants to merge 3 commits into
facebook:mainfrom
rubennorte:export-D55477743
Closed

Fix measure not using the last reported mark with a given name#43703
rubennorte wants to merge 3 commits into
facebook:mainfrom
rubennorte:export-D55477743

Conversation

@rubennorte
Copy link
Copy Markdown
Contributor

Summary:
Changelog: [internal]

(internal because this API isn't available in OSS yet)

I found a bug in the current implementation of performance.measure where the API would use the first mark reported under a specific name instead of the last one (found it in the new example in RNTester in D55477746 that re-logs the marks every time we click on a button).

The root cause for this problem is that we were using insert from std::unordered_set to update the value, but insert doesn't modify the value if it's already present.

This fixes the issue by doing a lookup and removing the value prior to inserting it.

Differential Revision: D55477743

@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 Mar 28, 2024
@facebook-github-bot
Copy link
Copy Markdown
Contributor

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

…cebook#43705)

Summary:

Changelog: [internal]

Differential Revision: D55477744
…RNTester (facebook#43704)

Summary:

Changelog: [internal]

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

Differential Revision: D55477746
…ook#43703)

Summary:

Changelog: [internal]

(internal because this API isn't available in OSS yet)

I found a bug in the current implementation of `performance.measure` where the API would use the first `mark` reported under a specific name instead of the last one (found it in the new example in RNTester in D55477746 that re-logs the marks every time we click on a button).

The root cause for this problem is that we were using `insert` from `std::unordered_set` to update the value, but `insert` doesn't modify the value if it's already present.

This fixes the issue by doing a lookup and removing the value prior to inserting it.

Differential Revision: D55477743
rubennorte added a commit to rubennorte/react-native that referenced this pull request Mar 28, 2024
…ame (facebook#43703)

Summary:

Changelog: [internal]

(internal because this API isn't available in OSS yet)

I found a bug in the current implementation of `performance.measure` where the API would use the first `mark` reported under a specific name instead of the last one (found it in the new example in RNTester in D55477746 that re-logs the marks every time we click on a button).

The root cause for this problem is that we were using `insert` from `std::unordered_set` to update the value, but `insert` doesn't modify the value if it's already present.

This fixes the issue by doing a lookup and removing the value prior to inserting it.

Differential Revision: D55477743
@facebook-github-bot
Copy link
Copy Markdown
Contributor

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

@analysis-bot
Copy link
Copy Markdown

Platform Engine Arch Size (bytes) Diff
android hermes arm64-v8a 18,877,583 +620
android hermes armeabi-v7a n/a --
android hermes x86 n/a --
android hermes x86_64 n/a --
android jsc arm64-v8a 22,250,372 +347
android jsc armeabi-v7a n/a --
android jsc x86 n/a --
android jsc x86_64 n/a --

Base commit: 4841373
Branch: main

rubennorte added a commit to rubennorte/react-native that referenced this pull request Mar 28, 2024
…ame (facebook#43703)

Summary:

Changelog: [internal]

(internal because this API isn't available in OSS yet)

I found a bug in the current implementation of `performance.measure` where the API would use the first `mark` reported under a specific name instead of the last one (found it in the new example in RNTester in D55477746 that re-logs the marks every time we click on a button).

The root cause for this problem is that we were using `insert` from `std::unordered_set` to update the value, but `insert` doesn't modify the value if it's already present.

This fixes the issue by doing a lookup and removing the value prior to inserting it.

Differential Revision: D55477743
rubennorte added a commit to rubennorte/react-native that referenced this pull request Apr 2, 2024
…ame (facebook#43703)

Summary:

Changelog: [internal]

(internal because this API isn't available in OSS yet)

I found a bug in the current implementation of `performance.measure` where the API would use the first `mark` reported under a specific name instead of the last one (found it in the new example in RNTester in D55477746 that re-logs the marks every time we click on a button).

The root cause for this problem is that we were using `insert` from `std::unordered_set` to update the value, but `insert` doesn't modify the value if it's already present.

This fixes the issue by doing a lookup and removing the value prior to inserting it.

Reviewed By: rshest

Differential Revision: D55477743
@facebook-github-bot facebook-github-bot added the Merged This PR has been merged. label Apr 2, 2024
@facebook-github-bot
Copy link
Copy Markdown
Contributor

This pull request has been merged in 2059894.

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.

3 participants