Daniel Judd’s Interesting Software Blog logo

Why do Electron Applications Use So Much CPU?


What Is Electron? #

Electron is a framework for creating mobile and desktop applications and enables cross-platform (hybrid) applications to be built quickly. It uses JavaScript, HTML and CSS to build the logic, interface and style just like a webpage.

Bundled with any electron application is the Chromium browser engine which means it shares similar vulnerabilities and bugs to Chromium-based browsers as listed here.

Electron Is Slow. #

Slow is a relative term, so when I say “slow” I mean compared to every other process I have running, and by the way; this is easier for me to notice with my older processor. Microsoft have (in an ironic sense of not using a low-level language on this occasion) mastered optimization with Visual Studio Code, in that it does not appear to take any more resources than it needs to, or it does some things very efficiently. Other applications are laggards in comparison when it comes to having responsive UI elements and sharing limited resources of bandwidth and space.

Case 1. Resource Mismanagement and Poor Optimization: #

I have recently given up on some service applications made in Electron as they were like poison to a well when it comes to occupying system resources. Many of these hindered my system by using a constant 5% of processing power while sitting idle. Also, for this reason I don’t think predominantly background services are excusable today if they run Electron (i.e., Dropbox since 2019).

Case 2. No Market for Linux: #

Electron is a problem for all Linux-based systems in that it is yet another dependency required to run software and must remain after installation, similarly to Java Runtime Environment (JRE). Tangentially: Java used to be the main way of porting complex applications to the browser (as applets) but is (arguably) obsolete due to modern JavaScript.

GNU/Linux does not work in harmony with overly sandboxed executables for many reasons and one of them is because a single, central runtime environment (i.e., JRE) is already too much of a liability for security and simple tasks. Also, having another (and no more capable) contender is not aligned with the user’s interests which tends to fall into pro “worse-is-better” - see worse is better (Richard P. Gabriel) and worse is better is worse (Richard P. Gabriel)

Case 3. “Worse-Is-Better”: #

Everything comes in threes so; even if there is a bigger picture to the motivations and development of software using a somewhat excusable framework for computing, the UI elements have always been inexcusable. I scavenge to find the buttons to press and everything is washed-out, soft and unpredictable. Electron applications have no context outside of its flexible, rectangular window because it is decoupled from the operating system’s inherent usability (especially in a customised graphical window manager or GUI). It has always had the problem of creating something too complex for mobile or something overly simple for desktop.




E-mail 📧 | Github 🐱‍💻 | Subscribe to RSS 👨🏻‍💻