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

Publishing speed drops when you minimise the application window #408

Open
sainquake opened this issue Nov 1, 2023 · 1 comment
Open

Comments

@sainquake
Copy link

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
Copy link
Contributor

silverv commented Jun 23, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants