Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FPSCounter #5770

Merged
merged 25 commits into from
Mar 28, 2024
Merged

FPSCounter #5770

merged 25 commits into from
Mar 28, 2024

Conversation

piaskowyk
Copy link
Member

@piaskowyk piaskowyk commented Mar 8, 2024

Summary

This PR adds a new Reanimated component which displays current fps for both JS and UI threads.

Test plan

Open Reanimated Example on your android/ios emulator and go into the Performance Monitor Example

@piaskowyk piaskowyk changed the title FPRCounter FPSCounter Mar 8, 2024
@latekvo
Copy link
Contributor

latekvo commented Mar 8, 2024

previousTimestamp is an integer, while timestamp was a float.
This caused around 1ms of disparity, giving an error of roughly 4% per frame.
After running with this fix for around 5 minutes, FPS remained at a stable 60 per second.
Previously, after 5 or so minutes fps was either 0. something, or above 5000.

@latekvo
Copy link
Contributor

latekvo commented Mar 11, 2024

Hot-reloads break this feature. Looks like both the old loopAnimationFrame() and useFrameCallback() keep on running after hot-reload.

@latekvo
Copy link
Contributor

latekvo commented Mar 11, 2024

This component does not have the earlier mention hot-reload issues when running as a component imported from react-native-reanimated.

@latekvo latekvo marked this pull request as ready for review March 11, 2024 16:30
@latekvo
Copy link
Contributor

latekvo commented Mar 15, 2024

Do we push this component just as an example for now, or should we make a standalone component out of it?

Copy link
Contributor

@szydlovsky szydlovsky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@latekvo The PR looks great! There are some smaller quality-of-life things to add. It would also be great if you featured a Summary and a Test plan for the PR. If it comes to the summary, just a few sentences describing the feature (and possibly its limitations if there are any), some video showcasing it would also be great. Test plan usually comes down to pointing to a specific example in our app - but if you have any extra code that the feature can be tested on, make sure to include it!

src/reanimated2/component/PerformanceMonitor.tsx Outdated Show resolved Hide resolved
app/src/examples/PerfomanceMonitorExample.tsx Outdated Show resolved Hide resolved
@latekvo latekvo marked this pull request as draft March 21, 2024 09:49
@latekvo
Copy link
Contributor

latekvo commented Mar 21, 2024

Thank you for the review @szydlovsky :)
I've applied most of these changes locally, but while at that, i found some new issues which i will have to resolve before requesting another review, and so i'm converting this PR to draft for now.
Thank you for your time

@latekvo latekvo marked this pull request as ready for review March 25, 2024 13:30
@latekvo

This comment was marked as outdated.

@latekvo
Copy link
Contributor

latekvo commented Mar 25, 2024

Screen.Recording.2024-03-25.at.15.05.35.mov

app/src/examples/PerfomanceMonitorExample.tsx Outdated Show resolved Hide resolved
app/src/examples/PerfomanceMonitorExample.tsx Outdated Show resolved Hide resolved
app/src/examples/PerfomanceMonitorExample.tsx Outdated Show resolved Hide resolved
@latekvo latekvo requested a review from szydlovsky March 28, 2024 08:33
Copy link
Contributor

@szydlovsky szydlovsky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants