Skip to content

[FIX] Cache maxDisplayRefreshRate on Android#1315

Open
sbarrio wants to merge 1 commit into
developfrom
sbarrio/fix/cache-max-display-refresh-rate-android
Open

[FIX] Cache maxDisplayRefreshRate on Android#1315
sbarrio wants to merge 1 commit into
developfrom
sbarrio/fix/cache-max-display-refresh-rate-android

Conversation

@sbarrio

@sbarrio sbarrio commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Raised by: #1313

maxDisplayRefreshRate was not being cached on Android, which was effectively calling display.supportedModes on every frame callback.

With this change, the value is calculated once, stored on a cached shared value and reused for every subsequent frame callback.

Additional Notes

Screenshot 2026-06-22 at 11 50 01

Thanks @ivan-moego to for raising.

Review checklist (to be filled by reviewers)

  • Feature or bugfix MUST have appropriate tests
  • Make sure you discussed the feature or bugfix with the maintaining team in an Issue
  • Make sure each commit and the PR mention the Issue number (cf the CONTRIBUTING doc)
  • If this PR is auto-generated, please make sure also to manually update the code related to the change

Copilot AI review requested due to automatic review settings June 22, 2026 09:58
@sbarrio sbarrio requested a review from a team as a code owner June 22, 2026 09:58

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR addresses a performance issue on Android where Display.supportedModes was being queried on every frame callback when computing refresh-rate-normalized JS frame times. It introduces caching so the max display refresh rate is computed once and reused.

Changes:

  • Cache the computed max display refresh rate in DdSdkImplementation to avoid repeated supportedModes calls on each frame.
  • Standardize fallback refresh rate usage by using DEFAULT_REFRESH_HZ instead of a hardcoded 60.0.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@sbarrio sbarrio force-pushed the sbarrio/fix/cache-max-display-refresh-rate-android branch from fd890a2 to 494b06e Compare July 1, 2026 15:16
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