bevy icon indicating copy to clipboard operation
bevy copied to clipboard

Switching desktops causes a spike in usage

Open rendaoer opened this issue 2 years ago • 7 comments

Bevy version

v0.10.0

[Optional] Relevant system information

If you cannot get Bevy to build or run on your machine, please include:

  • the Rust version you're using (you can get this by running cargo --version) cargo 1.67.1 (8ecd4f20a 2023-01-10)
  • the operating system or browser used, including its version macOS Ventura 13.2.1

If your bug is rendering-related, copy the adapter info that appears when you run Bevy.

SystemInfo { os: "MacOS 13.2.1 ", kernel: "22.3.0", cpu: "Apple M1", core_count: "8", memory: "8.0 GiB" }

What you did

On macOS, I'm used to using multiple desktops for windows [main desktop, browser, VS Code], and when I run a bevy program, a window is created on the main desktop, which is all fine at that point. By the time I switch to another desktop, the footprint of this bevy program goes up a lot, causing my computer to start heating up. This problem has nothing to do with my code, it just needs to be run and it will do that.

Additional information

Other information that can be used to further reproduce or isolate the problem. This commonly includes:

  • screenshots Normal: image

Switch desktop for a while and then come back: image

rendaoer avatar Mar 14 '23 03:03 rendaoer

image

Switching desktops means this: image

rendaoer avatar Mar 14 '23 03:03 rendaoer

I bet that this is no longer being framerate throttled by vsync. Can you check how fast your main loop runs while your desktop is swapped? And try playing with https://docs.rs/bevy/latest/bevy/window/enum.PresentMode.html

alice-i-cecile avatar Mar 14 '23 03:03 alice-i-cecile

I bet that this is no longer being framerate throttled by vsync. Can you check how fast your main loop runs while your desktop is swapped? And try playing with https://docs.rs/bevy/latest/bevy/window/enum.PresentMode.html

print.log Exactly as you would expect, the frame rate stays at 60 or below when on the main desktop, whether in foreground or background, but once you switch desktops, the frame rate slowly rises to 1200fps

rendaoer avatar Mar 14 '23 04:03 rendaoer

I bet that this is no longer being framerate throttled by vsync. Can you check how fast your main loop runs while your desktop is swapped? And try playing with https://docs.rs/bevy/latest/bevy/window/enum.PresentMode.html

No matter which PresentMode I use, the effect is the same, and Vsync fails when switching desktops

rendaoer avatar Mar 14 '23 04:03 rendaoer

Well, that's very helpful to know. What happens if you use bevy_framepace to limit the frame rate?

alice-i-cecile avatar Mar 14 '23 04:03 alice-i-cecile

Well, that's very helpful to know. What happens if you use bevy_framepace to limit the frame rate?

bevy_framepace is effective in terms of limiting the frame rate, but it feels like it causes significant frame rate fluctuations and doesn't support [email protected]

rendaoer avatar Mar 14 '23 04:03 rendaoer

this is the same as #5856

mockersf avatar Mar 14 '23 08:03 mockersf