Very high CPU usage on MacOS
- Dominant language
- Rust
- Stars
- 48.2k
- Forks
- 4.8k
- Avg merge
- 3d 16h
- Merged PRs (30d)
- 171
Description
## Summary
On MacOS, even simple Bevy apps cause very high CPU load; for example, even a blank app that just loads `DefaultPlugins` to render a blank window sits at ~50% CPU usage on an Apple Silicon M1. Add a couple of rendered meshes and postprocessing and it'll quickly go up to about ~90% CPU.
On Windows and Linux, the same app will comfortable sit below 1% (even with some light rendering.)
Additional notes:
- [A MRP has been provided here](https://github.com/hmans/bevy-mrp-macos-performance).
- It uses the `opt-level = 3` etc. trick from the docs.
- Compiling a `--release` build doesn't make a difference.
- In addition, when hiding the app, CPU load doubles, but I understand there have already been issues filed about this particular problem.
## Bevy version
`0.11.3` (but I also tried `66f72dd`, the newest commit on `main` at the time.)
## Relevant system information
- Rust 1.73.0
- MacOS Sonoma 14.0
```
AdapterInfo { name: "Apple M1", vendor: 0, device: 0, device_type: IntegratedGpu, driver: "", driver_info: "", backend: Metal }
SystemInfo { os: "MacOS 14.0 ", kernel: "23.0.0", cpu: "Apple M1", core_count: "8", memory: "16.0 GiB" }
```
## What you did
- Build a "blank" Bevy app ([code available here](https://github.com/hmans/bevy-mrp-macos-performance))
- Compile and run it
## What went wrong
Expected behavior: the app should cause CPU load in the single-digit percentage range, like it does on Windows (<1% CPU, on a Ryzen 7.)
Actual behavior: the app caused ~50% CPU load.
Contributor guide
Research direction
Start with the linked macOS performance MRP and its blank app using DefaultPlugins, then compare the behavior described on Apple Silicon with the Windows and Linux results. Done means identifying and addressing the cause of the excessive CPU usage and verifying that the blank app returns to the expected single-digit CPU range on macOS.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- macos, rust
- Domain
- computer-graphics, desktop, performance
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100