high cpu usage on idle
sigmaSd opened this issue · comments
linux fedora 40 wayland
import * as slint from "npm:slint-ui@1.7.1";
const ui = slint.loadSource(
"export component Window { }",
"main.js",
);
new ui.Window().run();
deno run -A a.ts # uses 100 % of one cpu core
if I force the app to run on xwayalnd the cpu usage becomes normal
WAYLAND_DISPLAY="" deno run -A a.ts #normal cpu usage
This is also reproducible with Node.js on Linux with Wayland. I'm not sure what's causing the constant activity, but I strongly suspect that it's related to the event loop polling.
This is not fixable with Deno, but with Node.js there is a way with #4469
When I increase the timeout https://github.com/slint-ui/slint/blob/master/api/node/index.ts#L994 the issue remains, but instead of 100%cpu all the time, it becomes 100 % for couple of seconds then normal then 100 % for a couple of seconds, etc
only if I comment out processEvents, it disappears
Right, this is the winit event loop pumping at full speed with wayland, for some reason.