Just stop, that is it, that is the tweet.
That is a tweet I see a lot in particular when it comes to people criticising both Node.Js and Electron. If anyone criticise these two technologies online in particular on Twitter and LinkedIn, immediately a horde of developers with jump in and defend these two technologies or simply tell people to stop criticising both of them. However, in both cases I find critique is in order and in particular when in comes to requesting people to stop using either of them. In this post I will focus on Electron and why I believe we should stop using it. I would also like to credit Nick host of The Linux Experiment on YouTube who made this video ELECTRON: Why people HATE it, why devs USE it for inspiring this post. Also any resource stats I list here is from a Mac, but I have seen roughly the same numbers on Windows and Linux as well.
If you use Google Chrome you will know that it eats system resources (RAM, CPU, etc.) for breakfast, lunch, and dinner, and if you have 16GB of RAM or less it literally sucks as a browser (it sucks for other reasons to but I do not want to get into that here). Why is this relevant? Well technically a Electron App is not a standalone app as for instance Apple Pages or Microsoft Word is, an Electron App runs within a Chromium instance and Chromium is what is in the stomach of Google Chrome (from an abstract perspective). Therefore, apps based on Electron is based on chromium and is just as resource eating happy and that is a problem, because they use resources for no good reasons. As a developer I have had to use Visual Studio Code (VSCode), Slack, and Microsoft Teams all at the same time for work and with Signal and Spotify running as well. Common for all of these apps is that they are electron apps and for VSCode alone, the app start with a memory usage of roughly 800MB which increases with usage and multiple document tabs. Then I add addons/extension for the languages and tools I need, plus spell control and I end up with an idle RAM usage between 1.3 and 2GB which is insane! Emacs for a comprasion with all the plugins I have (similar to what I use in VSCode) in idle runs at between 90mb - 180mb depending on the files I have open. That is 1344.44% increase in resource consumption in IDLE for VSCode compared to Emacs for the best case scenario. Spotify is even worse with a best case idle consumption of 1.5GB and I have seen none idle reach up to 8GB. Eight GB of RAM just to play music useless. So that is just two apps, I will now list the apps with their lowest idle memory consumption I have seen:
- VSCode (with plugins): 1.3GB
- Spotify: 1.5GB
- Slack (with three work groups): 617MB
- Signal: 578MB
- Microsoft Teams (with one team): 800MB
That is a grand total of 4795 MB (or 4.7GB) of RAM. In a pretty standard home system with 16GB of RAM that is a bit over 1/4 of the system resources or a 1/8 of a pretty normal developer machine with 32GB of RAM. Just running 5 Electron apps in idle mode, now let us say we add Hyper and assume it use something like Signal, that will bring us over 5GB of idle memory use. It is literally stupid, the amount of memory usage Electron Apps use. Even worse what if you are at the same time a Google Chrome / Chromium or other blink based browser user. Well your memory usage is just going up, up and up for no good reason. Other than some developer/company was to lazy, cheap, or both to actually develop apps for each platform, which is not really a good reason. I would like to inject here I really love all the above apps with the exception of Spotify, which can go die in Swedish forest.
BUT RAM IS CHEAP!!!! Yes RAM is cheap, but that is no excuse. Knowingly using something that is this useless in terms of handling its resource consumption should be a dead give away that a producent of the software don’t care about the user, only the bottom line.
As if the memory consumption alone is not a sway to stop using electron for development there is another which Nick from the Linux Experiment focused a lot on and that is UI inconsistency. Electron apps looks like the developer wants it, not like the system wants it. Therefore a electron app can look (and most do) really out of place on a Mac or Gnome based Linux distribution and it is honestly really weird how users just accept this, in particular mac users. By not having a common design language (similar to what Apple enforce on iPhone and Mac through the app store) we are seeing apps that looks really weird and not in a good way. They may look normal on Windows but on other system they look crap and are confusing for the user. It is pretty impressive we let developers get away with it.
So What can developers and companies do to avoid this? Well for starts stop using Electron, it will cost the company more money and it will take longer time but you will get apps that are better for users and hopefully get you better customer satisfaction. But how to stop using electron? Well first of all right what you can in a cross platform language most are these days, I of cause recommend C++ because I am addict, but Rust is also getting there. This will allow you to create shallow apps on top in Swift for iOS and MacOS, GTK for Gnome, QT for KDE, UPF (or whatever it is called on windows), and Kotlin for Android. You will need UX people for it on all platforms but gods be damned you should have already done that with the Electron version. If you have an app that is mostly based on Web Api calls you can build that in whatever language you want and then again just have the shallow apps client side. It is not rocket science to make good native apps.