OpenCyphal / yukon

The OpenCyphal IDE
https://opencyphal.org
MIT License
16 stars 0 forks source link

Publishing speed drops when you minimise the application window #408

Open sainquake opened 10 months ago

sainquake commented 10 months ago

Hi, I have found out an interesting feature that the publishing speed drops when you minimise the application window.

I have connected device via Babel to Yukon set up to publish topic in 15 Hz. This theme sends float value and device converts it to PWM signal. I connected the servo to my board and tested it. Everything was ok but after I minimise Yukon servo starts shaking from 0 position to other. Its happening when device is lost signal in 500 ms it turns servo to default value, i mean its a part of a programme of device.

So when I minimise the window of Yukon, the publication frequency decreases from 15 Hz to values less than 2 Hz.

silverv commented 2 months ago

https://pracucci.com/electron-slow-background-performances.html

Chromium recently became more aggressive on power saving when the browser window is in background or minimized. This is usually not a problem, but in some specific applications built with Electron this could lead to performance issues.

For example, we’re building Spreaker Studio for Desktop, an audio broadcasting tool for Mac and Windows, and performances should never degrade while broadcasting, either the app is in foreground or background.

To avoid such issue, you can add the Chromium switch --disable-renderer-backgrounding: it basically tells Chromium to not reduce performances (and save CPU cycles) when the window is in background.

var app = require("app");

app.commandLine.appendSwitch("disable-renderer-backgrounding"); app.on("ready", function () { // ... });

About page-visibility BrowserWindow option

When you spawn a new BrowserWindow() you can specify a set of options. Electron supports many options, including { "web-preferences": { "page-visibility": true }} that forces the page to be always in the visible state, instead of reflecting current window’s visibility.

Unfortunately, it doesn’t fix our performances issue, so in case it doesn’t help you too please give a try to --disable-renderer-backgrounding switch.