bevy: Very high CPU usage with empty example using just default plugins
Bevy version
Tested on both 0.4 and recent master a8952569253c5712e890e250cd10c999c1a6b379.
Operating system & version
macOS 10.14 x86_64 (MacBook Pro 2014, 2c/4t 2.8GHz Intel Core i5).
Latest nightly rustc
, with the default rust linker (I haven’t installed lld
).
What you did
I tested the following code on both versions mentioned above, in debug and release modes.
main.rs:
use bevy::prelude::*;
fn main() {
App::build()
.add_plugins(DefaultPlugins)
.add_plugin(bevy::diagnostic::FrameTimeDiagnosticsPlugin::default())
.add_plugin(bevy::diagnostic::LogDiagnosticsPlugin::default())
.run();
}
Cargo.toml:
[package]
name = "city_simulator"
version = "0.1.0"
authors = ["nehalem501"]
edition = "2018"
[dependencies]
bevy = { git = "https://github.com/bevyengine/bevy", rev = "a8952569253c5712e890e250cd10c999c1a6b379" }
What you expected to happen
Have the app window show app with low CPU usage.
What actually happened
I have 100% CPU usage with this code when compiled in debug mode, and around 50% CPU usage in release mode. This seems very excessive for drawing an empty window and displaying a few log lines in a terminal. Am I doing something wrong ?
Additional information
These are the logs in debug mode, vsync seems to work:
Feb 17 09:27:18.040 INFO bevy_diagnostic::log_diagnostics_plugin: frame_time : 0.017584 (avg 0.016661)
Feb 17 09:27:18.040 INFO bevy_diagnostic::log_diagnostics_plugin: fps : 59.463637 (avg 59.926370)
Feb 17 09:27:18.040 INFO bevy_diagnostic::log_diagnostics_plugin: frame_count : 227.000000 (avg 227.000000)
And these the logs in release mode:
Feb 17 09:44:54.987 INFO bevy_diagnostic::log_diagnostics_plugin: frame_time : 0.017124 (avg 0.016655)
Feb 17 09:44:54.987 INFO bevy_diagnostic::log_diagnostics_plugin: fps : 60.254282 (avg 60.020315)
Feb 17 09:44:54.987 INFO bevy_diagnostic::log_diagnostics_plugin: frame_count : 1605.000000 (avg 1605.000000)
Screenshot of System Monitor with the debug version:
Screenshot of System Monitor with the release version:
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 9
- Comments: 37 (11 by maintainers)
briefly puts on world-weary project owner hat however given the frequency of percent-cpu-usage-related issues, maybe we should optimize for public perception anyway, despite the facts of the situation
@geNAZt
I consider that to be a separate issue. The many sprites example is a intended to be stressful (and we are already in the process of optimizing it). This thread is about “baseline” cpu usage when nothing is happening.
I agree that using CPU percentage for measuring performance of big multithreaded apps is not very serious. But an empty project with just the default plugins shouldn’t make a laptop fan spin at full speed.
If I write minimal C code to show a window and call
glClear
at 60hz, I expect it to not be very demanding and not use 60% of my CPU. Bevy is of course much more complex, so I expect more bloat than this very simple example, but if I write a game, I want most resources to be used on this game’s complex algorithms, not on the framework.Please don’t view this as a rant, I’m just trying to understand what is going on.
How about CPU temps? 😝
I am definitely not getting 60 fps on a high end macbook pro with really simple bevy projects so something is wrong.