DioxusLabs / blitz

High performance HTML and CSS renderer powered by WGPU

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Current main spinloops on macOS

BlackHoleFox opened this issue · comments

Problem

While running a very basic hello world app, the Blitz-driven binary spinloops at 100% CPU usage despite nothing going on. From what I can tell, it appears to be a main loop scheduling problem thats resulting in the system making an excessive number of callbacks into Tao/Blitz.

Steps To Reproduce

Steps to reproduce the behavior:

  • Create a basic application with the following source:
#![allow(non_snake_case)]
use dioxus::prelude::*;

fn main() {
    let rt = tokio::runtime::Builder::new_multi_thread()
        .enable_io()
        .enable_time()
        .build()
        .unwrap();

    println!("launching app");
    rt.block_on(blitz::launch(App));
}

fn App(cx: Scope) -> Element {
    cx.render(rsx! {
        div {
            "Hello, world!"
        }
    })
}
[dependencies]
# Waiting on https://github.com/DioxusLabs/blitz/pull/38/ to merge, so you may need to use a local copy
blitz = { git = "https://github.com/DioxusLabs/blitz.git" }
dioxus = { git = "https://github.com/DioxusLabs/dioxus/" }
tokio = { version = "1.28.0", features = ["full"] }
  • Launch the app with cargo run.

Expected behavior

The app would remain at 0% CPU usage when not rendering anything or being interacted with.

Screenshots

Here are some screenshots from profiling with Instruments.app, which show the excessive calls being made. The numbers go up extremely quick while running (my sample was taken over 30s).

image image image

Environment:

  • Renderer version: Dioxus master
  • Rust version: rustc 1.70.0 (90c541806 2023-05-31)
  • OS info: macOS 13

Questionnaire

  • I don't have time to fix this right now, but maybe later (Sorry, I was just trying out the new renderer for now)

Closing as I believe this is no longer the case in the new Blitz which seems to have reasonable cpu usage.