4 ms·
This is a bit of an aside - but can anyone explain why Electron apps use so much memory/system resources? Is this a fundamental thing or accidental thing and co
by torginus 5y ago
This is a bit of an aside - but can anyone explain why Electron apps use so much memory/system resources? Is this a fundamental thing or accidental thing and could be remedied rather easily? I wonder why there hasn't been significant effort directed toward this, as this is the number 1 issue of desktop applications today.
I have a few guesses/questions:
- What kind of data is causing the GBs of memory usage? Is it JS objects, cached content, intermediate rendering data?
- Chrome is architected as a multi-process app, in order to isolate and share resources between websites. Since Electron runs as a single app, it doesn't need this overhead, how hard would it be to turn it off?
-Would it gain us a lot if we removed v8/minimized JS on the 'frontend' and just pushed all the html from the 'backend'?
-Is using node as the backend the cause of excess resource usage, would using something else be better?
- remus 5y agoAs I understand it, the chrome team have tended towards using more memory as a way of improving performance (i.e. trading space for time), with the feeling being that most systems have quite a lot of memory (relatively speaking) so why not use it. This isn't a one off thing so would be challenging to change. It's more a case of many small decisions about increasing memory usage that in aggregate add up.
- swiley 5y agoTk and gtk2 apps were performant and used way less memory so that doesn’t seem like it should be necessary.
- _fat_santa 5y agoI might be wrong here so someone correct me but I believe it's because every time you open a new electron app, you are opening another instance of Chrome. So if you have Chrome, VSCode and Figma running, that's 3 instances of Chrome each eating their respective 2-3GB of memory and associated CPU cycles.
- torginus 5y agoYou are not wrong, but there are multiple billion dollar companies that build their products on top of Electron. Presumably they could afford to hire engineers or Google could step in and optimize Chrome's renderer for Electron's use cases. I may be wrong, but as things are now, Electron, more or less packages an unmodified, headless Chromium.
- beardyw 5y agoYes, and if you allow it, an Electron app can just open the chrome debugger you know on the browser part of the app. There is a messaging system between that and the node part, to provide stuff like file access.
- lenkite 5y agoFundamental architectural decisions in the Chromium code cannot be solved via patching no matter how many billions are thrown at it. Would likely need a large rewrite which is effectively a new project.