logoalt Hacker News

blackoilyesterday at 4:51 PM2 repliesview on HN

Why are electron apps memory intensive compared to other cross platform frameworks. Is it language, UI system or legacy?


Replies

gamefamecameyesterday at 5:53 PM

Electron apps tend to use a lot of memory because the framework favors developer productivity and portability over runtime efficiency.

- Every Electron app ships with its own copy of Chromium (for rendering the UI) and Node.js (for system APIs). So even simple apps start with a fairly large memory footprint. It also means that electron essentially ships 2 instances of v8 engine (JIT-compiler used in Chromium and NodeJS), which just goes to show how bloated it is.

- Electron renders the UI using HTML, CSS, and JavaScript. That means the app needs a DOM tree, CSS layout engine, and the browser rendering pipeline. Native frameworks use OS widgets, which are usually lighter and use less memory.

- Lastly the problem is the modern web dev ecosystem itself; it is not just Electron that prioritises developer experience over everything else. UI frameworks like React or Vue use things like a Virtual DOM to track UI changes. This helps developers build complex UIs faster, but it adds extra memory and runtime overhead compared to simpler approaches. And obviously don't get me started on npm and node_modules.

PacificSpecificyesterday at 5:46 PM

Loading a browser context isn't helping.