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

Reduce iOS cpu usage #16548

Merged
merged 2 commits into from
Nov 29, 2024
Merged

Conversation

mockersf
Copy link
Member

@mockersf mockersf commented Nov 29, 2024

Objective

  • Avoid recreating the monitor every loop (temp fix until it's done properly on winit side)
  • Add a new WinitSettings preset for mobile that makes the winit loop wait more and recommend its usage

@mockersf mockersf added the O-iOS Specific to the iOS mobile operating system label Nov 29, 2024
@mockersf mockersf added this to the 0.15 milestone Nov 29, 2024
@alice-i-cecile alice-i-cecile added C-Performance A change motivated by improving speed, memory usage or compile times P-High This is particularly urgent, and deserves immediate attention labels Nov 29, 2024
@alice-i-cecile
Copy link
Member

Prompted by #16541, but not a full fix. See that thread for more information.

@alice-i-cecile alice-i-cecile added the S-Needs-Review Needs reviewer attention (from anyone!) to move forward label Nov 29, 2024
Copy link
Member

@alice-i-cecile alice-i-cecile left a comment

Choose a reason for hiding this comment

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

I think this is a good fix given the part of the release cycle we're in. There's definitely something fundamentally wrong with how winit / Bevy is interacting with iOS here though.

@alice-i-cecile
Copy link
Member

rusticorn: That looks good to me it’s what I did locally as well 👍

That's a second approval. Merging :)

@alice-i-cecile alice-i-cecile added this pull request to the merge queue Nov 29, 2024
@alice-i-cecile alice-i-cecile added S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it and removed S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Nov 29, 2024
Copy link
Contributor

@extrawurst extrawurst left a comment

Choose a reason for hiding this comment

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

Awesome! Looks good to me

@@ -34,6 +35,9 @@ fn main() {
..default()
}),
)
// Make the winit loop wait more aggressively when no user input is received
// This can help reduce cpu usage on mobile devices
Copy link
Contributor

Choose a reason for hiding this comment

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

Worth mentioning that this can and is encouraged to use to set desired refresh rate based on the games requirements: low rate fine in a menu and high during interactive gameplay for example

Merged via the queue into bevyengine:main with commit c1d392a Nov 29, 2024
34 checks passed
mockersf added a commit that referenced this pull request Nov 29, 2024
# Objective

- Avoid recreating the monitor every loop (temp fix until it's done
properly on winit side)
- Add a new `WinitSettings` preset for mobile that makes the winit loop
wait more and recommend its usage
ecoskey pushed a commit to ecoskey/bevy that referenced this pull request Dec 2, 2024
# Objective

- Avoid recreating the monitor every loop (temp fix until it's done
properly on winit side)
- Add a new `WinitSettings` preset for mobile that makes the winit loop
wait more and recommend its usage
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-Performance A change motivated by improving speed, memory usage or compile times O-iOS Specific to the iOS mobile operating system P-High This is particularly urgent, and deserves immediate attention S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants