Electron - Slow performances in background
CommentsChromium 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.
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.
Related links
- GitHub issue where @zcbenz helped us to figure out the solution
- List of Chromium Command Line Switches
- Electron
app
module documentation
You may also be interested in ...
- Electron? It works for us, and makes desktop fun and fast
- Electron - Open DevTools in a popup
- Electron - Enable copy and paste
- Electron - Signing a Mac Application
Upcoming conferences
Incontro DevOps 2020 | Virtual | 22 October 2020 |
---|