Electron considered harmful because it rides on Chromium

By: (plus.google.com) +David Herron; Date: September 24, 2017

Tags: Node.JS » Electron

Electron is perhaps the greatest gift to cross platform application development in ages. I've been working on cross platform application development for over 20 years, with over 10 years spent IN the Java SE team at Sun. Today I'm a happy Node.js developer, and have spent the last couple months learning Electron and am totally enjoying the application-writing experience in Electron. It is so easy and quick to develop desktop applications using a repurposed web browser. Development is fast and intuitive, assuming you're familiar with HTML and CSS and JavaScript website development.

But a nagging thought came to mind yesterday. That Electron application requires running a large portion of the Chrome web browser. Meaning, my laptop not only has the regular Chrome browser running, but another in GitKraken, another in Visual Studio Code (and I'd been running Atom before discovering VSCode), and yet another for the application I'm developing. That's four Chrome instances, and the result simply is not scalable. Each additional running Electron-based app causes a whole new Chrome instance to exist. Is Electron an unscalable mess?

According to Activity Monitor the memory consumption is:

  • GitKraken: 2.10 GB
  • Google Chrome: 461 MB
  • VS Code: 289 MB
  • My application: 76 MB

The first three have been running for several weeks - it's been 52 days since my last reboot. A little experiment - I restarted GitKraken, and its memory footprint now stands at 86 MB.

Chrome has over 100 tabs open, except I use The Great Suspender to force idle tabs to go idle, which minimizes memory consumption. VS Code has several windows open with a few dozen files open.

This doesn't seem TOO excessive if I compare with the other app's I have open. Eclipse is weighing in at well over 2 GB. I started it up fresh this morning. I restarted it, and now Eclipse is consuming 560 MB of memory.

I have a copy of Enterprise Architect (a high end UML editor) running under Wine, at 400 MB of memory consumption.

Preview, Apple's PDF/image viewer, is open, with several PDF's open, and it's consuming over 1 GB of memory.

The Trello title-menu-bar app is running, and is consuming 199 MB memory.

This is the application I'm writing - an editor meant to be used with (akashacms.com) AkashaCMS, the static website content management system I've developed. The editor is a little sketchy at the moment. It uses the Ace editor component in one pane, and a simple <iframe> to view the rendered web page in the other pane. I'm using Bootstrap 4 for the UI framework, and the app can have multiple editor tabs open simultaneously. And to prove that we have Chrome, I've opened up the Developer Tools.

That is oh so very cool to have Chrome Developer Tools as part of your desktop app development platform. I've never seen a desktop GUI toolkit that automatically includes such a powerful tool. Usually tools of that caliber are purchased separately at a large price per developer.

But - having Chrome Developer Tools simply means that yes indeed the application runs on Chrome.

For some reason there are over 90 processes involved with keeping VS Code running. I have 13 top level VS Code windows, each with a few files open. Yes, I've got a lot of files open, but isn't the memory footprint excessive?

I got to writing this because of (hackernoon.com) Compile JavaScript? Really? -- an article going over different techniques to compile JavaScript, or compile other languages to JavaScript. One thread in that article is this observation, that Electron is very heavy-weight because it carries along most of Chrome.

I'm not sure the article reaches any particular point. However, from my experience with cross-platform GUI toolkits I can describe what would be required to build cross-platform GUI applications with Node.js:

  • A GUI widget library bound to Node.js. For Java there's AWT and Swing, unless you're from the Eclipse camp in which case it's SWT. For Tcl there's Tk. For Gnome there's GTK, for KDE there's Qt, and so on.
  • A set of compelling GUI widgets
  • Compiling that widget library for every platform, and a staff to keep the semantics straight while interpolating to the API's on each platform

It's extremely difficult to get it right, and every GUI toolkit I've dealt with was buggy.

That Electron does such a good job is because Google does all the hard work that I've just glossed over. Trust me - developing a cross platform GUI toolkit is excruciatingly difficult.

Taking this route means losing the advantage of HTML+CSS+JavaScript for desktop GUI development. Part of why Electron is such a breeze is because the tools are extremely familiar because we use them for web development.

A detour - JavaFX

I first time heard of using HTML or CSS for desktop application about 10 years ago when the JavaFX project was starting up. I was there, in the JavaSE team, when JavaFX was announced, and watched over the next couple years as more and more people were sucked out of JavaSE to work on JavaFX.

In any case, JavaFX developers came to the Swing team for a discussion. The JavaFX developers tried to convince the Swing team that getting regular web developers on board with using JavaFX meant using CSS and other web technologies in desktop application design. I remember thinking that an extremely odd suggestion.

Back on track with Electron

But, now that I'm doing Electron development, this makes sense. HTML+CSS+JavaScript is a powerful combination for desktop application development. The open question is whether it absolutely must require using Chrome as the platform?

What about the Chrome Applications model?

One way to skin this cat is the Chrome App's model that Google developed for Chromebooks. I've been using a Chromebook for several years, and for about a year used one as my primary laptop.

There's a whole App store running on Chromebooks, with a large number of applications available.

When a Chrome App is installed, its icon shows up on a Launcher window. You can drag the icons down to a toolbar at the bottom of the screen just like on Mac OS X. The app's launch as top-level windows on par with the Chrome windows. The app's are developed using HTML+CSS+JavaScript, just like Electron.

What's important for this conversation is that you have one Chrome instance running several applications.

In other words - what if you installed an Electron runtime on the computer, and then installed Electron applications to use that runtime? That would limit the memory footprint since the Chrome instance would be shared across multiple applications.

Summary

I'm not finding that Electron is as heavy-weight as you might think considering it carries along most of Chrome.

« Node.js toolkit for mobile iOS and Android devices announced by Janea Systems Node.js forked, Ayo.JS, is trying to find its way »
2016 Election 2018 Elections Acer C720 Ad block Air Filters Air Quality Air Quality Monitoring AkashaCMS Amazon Amazon Kindle Amazon Web Services America Amiga and Jon Pertwee Android Anti-Fascism AntiVirus Software Apple Apple Hardware History Apple iPhone Apple iPhone Hardware April 1st Arduino ARM Compilation Artificial Intelligence Astronomy Astrophotography Asynchronous Programming Authoritarianism Automated Social Posting AWS DynamoDB AWS Lambda Ayo.JS Bells Law Big Brother Big Data Big Finish Big Science Bitcoin Mining Black Holes Blade Runner Blockchain Blogger Blogging Books Botnets Cassette Tapes Cellphones China China Manufacturing Christopher Eccleston Chrome Chrome Apps Chromebook Chromebox ChromeOS CIA CitiCards Citizen Journalism Civil Liberties Climate Change Clinton Cluster Computing Command Line Tools Comment Systems Computer Accessories Computer Hardware Computer Repair Computers Conservatives Cross Compilation Crouton Cryptocurrency Curiosity Rover Currencies Cyber Security Cybermen Cybersecurity Daleks Darth Vader Data backup Data Formats Data Storage Database Database Backup Databases David Tenant DDoS Botnet Department of Defense Department of Justice Detect Adblocker Developers Editors Digital Nomad Digital Photography Diskless Booting Disqus DIY DIY Repair DNP3 Do it yourself Docker Docker MAMP Docker Swarm Doctor Who Doctor Who Paradox Doctor Who Review Drobo Drupal Drupal Themes DVD E-Books E-Readers Early Computers eGPU Election Hacks Electric Bicycles Electric Vehicles Electron Eliminating Jobs for Human Emdebian Encabulators Energy Efficiency Enterprise Node EPUB ESP8266 Ethical Curation Eurovision Event Driven Asynchronous Express Face Recognition Facebook Fake News Fedora VirtualBox Fifth Doctor File transfer without iTunes FireFly Flash Flickr Fraud Freedom of Speech Front-end Development G Suite Gallifrey Gig Economy git Github GitKraken Gitlab GMAIL Google Google Chrome Google Gnome Google+ Government Spying Great Britain Green Transportation Hate Speech Heat Loss Hibernate High Technology Hoax Science Home Automation HTTP Security HTTPS Human ID I2C Protocol Image Analysis Image Conversion Image Processing ImageMagick In-memory Computing InfluxDB Infrared Thermometers Insulation Internet Internet Advertising Internet Law Internet of Things Internet Policy Internet Privacy iOS iOS Devices iPad iPhone iPhone hacking Iron Man iShowU Audio Capture iTunes Janet Fielding Java JavaFX JavaScript JavaScript Injection JDBC John Simms Journalism Joyent Kaspersky Labs Kext Kindle Kindle Marketplace Large Hadron Collider Lets Encrypt LibreOffice Linux Linux Hints Linux Single Board Computers Logging Mac Mini Mac OS Mac OS X MacBook Pro Machine Learning Machine Readable ID Macintosh macOS macOS High Sierra macOS Kext MacOS X setup Make Money Online Make Money with Gigs March For Our Lives MariaDB Mars Mass Violence Matt Lucas MEADS Anti-Missile Mercurial MERN Stack Michele Gomez Micro Apartments Microsoft Military AI Military Hardware Minification Minimized CSS Minimized HTML Minimized JavaScript Missy Mobile Applications Mobile Computers MODBUS Mondas Monetary System MongoDB Mongoose Monty Python MQTT Music Player Music Streaming MySQL NanoPi Nardole NASA Net Neutrality Network Attached Storage Node Web Development Node.js Node.js Database Node.js Performance Node.js Testing Node.JS Web Development Node.x North Korea npm NVIDIA NY Times Online advertising Online Community Online Fraud Online Journalism Online Photography Online Video Open Media Vault Open Source Open Source and Patents Open Source Governance Open Source Licenses Open Source Software OpenAPI OpenJDK OpenVPN Palmtop PDA Patrick Troughton PayPal Paywalls Personal Flight Peter Capaldi Peter Davison Phishing Photography PHP Plex Plex Media Server Political Protest Politics Postal Service Power Control President Trump Privacy Private E-mail server Production use Public Violence Raspberry Pi Raspberry Pi 3 Raspberry Pi Zero ReactJS Recaptcha Recycling Refurbished Computers Remote Desktop Removable Storage Republicans Retro Computing Retro-Technology Reviews RFID Rich Internet Applications Right to Repair River Song Robotics Robots Rocket Ships RSS News Readers rsync Russia Russia Troll Factory Russian Hacking Rust SCADA Scheme Science Fiction SD Cards Search Engine Ranking Season 1 Season 10 Season 11 Security Security Cameras Server-side JavaScript Serverless Framework Servers Shell Scripts Silence Simsimi Skype SmugMug Social Media Social Media Networks Social Media Warfare Social Network Management Social Networks Software Development Software Patents Space Flight Space Ship Reuse Space Ships SpaceX Spear Phishing Spring Spring Boot Spy Satellites SQLite3 SSD Drives SSD upgrade SSH SSH Key SSL Stand For Truth Strange Parts Swagger Synchronizing Files Tegan Jovanka Telescopes Terrorism The Cybermen The Daleks The Master Time-Series Database Tom Baker Torchwood Total Information Awareness Trump Trump Administration Trump Campaign Twitter Ubuntu Udemy UDOO US Department of Defense Video editing Virtual Private Networks VirtualBox VLC VNC VOIP Vue.js Walmart Weapons Systems Web Applications Web Developer Resources Web Development Web Development Tools Web Marketing Webpack Website Advertising Weeping Angels WhatsApp William Hartnell Window Insulation Windows Windows Alternatives Wordpress World Wide Web Yahoo YouTube YouTube Monetization