Skip to content

Conversation

@JesusRojass
Copy link
Contributor

Discussion

Fix for #10220 by deriving slow-frame budget from UIScreen.maximumFramesPerSecond

User Statements:

  • Slow rendering values on tvOS approximately 150 times higher (~60%) than on iOS (<1%)
  • ProMotion devices reporting inaccurate frame metrics during refresh rate changes
  • 50Hz tvOS displays (Europe) incorrectly flagging smooth 18ms frames as slow
  • Static 60Hz assumption breaks on modern Apple hardware with variable refresh rates

What was done?

  • Replace fixed 16 ms with slowBudget = 1.0 / UIScreen.mainScreen.maximumFramesPerSecond (seconds). Keeps frozen at 700 ms. Behavior at 60 Hz preserved.
  • Cache maxFPS and recompute slowBudget only when needed.
  • Scoped refresh of the cache to tvOS on app-did-become-active.

Testing

All green ✅

Added tests:

  • 50 fps budget ~20 ms, 60 fps ~16.67 ms, 120 fps ~8.33 ms - assert slow/ok classification and frozen remains at 700 ms.
  • tvOS-specific test mirroring testSlowFrameIsRecorded.
  • Tests stub maximumFramesPerSecond locally to avoid global state.

API Changes

No API Changes

@gemini-code-assist
Copy link
Contributor

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

@JesusRojass
Copy link
Contributor Author

/gemini review

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a dynamic slow frame threshold based on UIScreen.maximumFramesPerSecond to improve frame metric accuracy on devices with variable refresh rates, such as ProMotion displays and 50Hz tvOS displays. The changes involve caching the maximum FPS and recalculating the slow frame budget when necessary, especially on tvOS when the screen mode changes. The implementation is solid and includes comprehensive unit tests for the new logic. My feedback includes a couple of suggestions to improve code maintainability by reducing duplication in both the implementation and the new tests.

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.

2 participants