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

CPU Usage 12% even though the window is minimized #204

Closed
1 of 2 tasks
Ciantic opened this issue Apr 25, 2021 · 1 comment
Closed
1 of 2 tasks

CPU Usage 12% even though the window is minimized #204

Ciantic opened this issue Apr 25, 2021 · 1 comment
Labels
platform: Windows status: waiting Waiting for a response or another PR type: bug

Comments

@Ciantic
Copy link

Ciantic commented Apr 25, 2021

Describe the bug
CPU Usage 12% even though the window is minimized, and no WebViewBuilder in use

Steps To Reproduce

[dependencies]
wry = { git = "https://github.com/tauri-apps/wry", branch = "dev" }
fn main() -> wry::Result<()> {
    use wry::{
        application::{
            event::{Event, StartCause, WindowEvent},
            event_loop::{ControlFlow, EventLoop},
            window::WindowBuilder,
        },
        webview::WebViewBuilder,
    };

    let event_loop = EventLoop::new();
    let window = WindowBuilder::new()
        .with_title("Hello World")
        .build(&event_loop)?;
    // let _webview = WebViewBuilder::new(window)?
    //     .with_url("https://tauri.studio")?
    //     .build()?;

    event_loop.run(move |event, _, control_flow| {
        *control_flow = ControlFlow::Poll;

        match event {
            Event::NewEvents(StartCause::Init) => println!("Wry has started!"),
            Event::WindowEvent {
                event: WindowEvent::CloseRequested,
                ..
            } => *control_flow = ControlFlow::Exit,
            _ => (),
        }
    });
}

Expected behavior
Something considerably less

Screenshots
image

Platform and Versions (please complete the following information):
OS: Windows 10
Rustc: rustc 1.51.0 (2fd73fabe 2021-03-23)

Would you assign yourself to resolve this bug?

  • Yes
  • No

This bug maybe related to winit bug rust-windowing/winit#1634 but maybe not, however I think winit should also be fixed, IMO it's unusable with silent reading of mouse and keyboard by default.

@wusyong wusyong added type: bug platform: Windows status: waiting Waiting for a response or another PR labels Apr 26, 2021
@wusyong
Copy link
Member

wusyong commented May 4, 2021

I can reproduce this and also got around 15% CPU usage.
But it can get significantly lower if the control flow is set toControlFlow::Wait.
Even with moving mouse and typing keyboard constantly will only be 1~2%.
I think it's safe to close this issue unless we see any more usage outburst.

@wusyong wusyong closed this as completed May 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform: Windows status: waiting Waiting for a response or another PR type: bug
Projects
None yet
Development

No branches or pull requests

2 participants