Skip to content

Very high CPU usage with empty example using just default plugins #1462

@nehalem501

Description

@nehalem501

Bevy version

Tested on both 0.4 and recent master a895256.

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 2021-02-17 at 09 29 39

Screenshot of System Monitor with the release version:
Screenshot 2021-02-17 at 13 34 36

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-PerformanceA change motivated by improving speed, memory usage or compile timesO-MacOSSpecific to the MacOS (Apple) desktop operating system

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions