Out of curiosity, Does anyone know where exactly does the bloat of the electron come from in terms of ram usage, compared to a "native toolkit"?
Because just parsing html/xml/some declarative ui description to create a scenegraph and pushing it to the GPU is something I'm sure even native frameworks like Qt do.
Yet I can feel the latency in vs code vs. say sublime text.
It's tempting to blame the huge js blobs trying to create an application abstraction over a document object model but i feel like there should be more to it than just that...
It’s the extra API and layout rules. A lot of UI toolkit supports some version of xml for declarative UI programming. And they will create a widget tree to match it. But they’re far simpler than the DOM and therefore faster.
Also think all the web subsystem that has been added over they years. Every electron app is bundling those in, even the inspector. It’s shipping a whole VM with your code. Containers have at least the decency to strip things down to the bare minimum, but no one is thinning chromium to only what they need.
- HTML rendering - which is insanely complex to do efficiently for arbitrary web apps.
- Video conferencing software
- A graphics engine. Used for rendering web content, canvas2d, webgl, webgpu and video encoding & decoding for a bunch of formats. It also has a bunch of backends (eg CPU, Metal, Vulcan, etc)
- JS, and every feature ever added to JS.
- WASM compiler, optimizer & runtime
- Memory manager, process isolation per tab, and all the plumbing to make that work.
- The Inspector - which contains a debugger and most of an IDE for JS, WASM, CSS and HTML.
- So much interop. Like chromecast support, http1, http2, quic, websockets, webtransport, webrtc, javascript remote debugger protocol, support for lots of pre-unicode text formats, DoH, webdriver, and on and on.
- Extension support
- Gamepad drivers, web bluetooth, webserial, midi support
What am I missing? Probably lots of stuff. I have no idea how much each of these components contributes to browser bloat. But all up? Its a lot. Chrome is bigger than most complete operating systems from a decade or two ago. Browser vendors have to pick between fast, simple and fully featured. Chrome sacrifices simplicity every time.
A lot of it is sandboxing and the multiprocess architecture that requires. There's lots of IPC. Custom Chrome builds can disable the IPC and run everything in one process, but Electron doesn't because they try to minimize the number of patches they apply so it's easier to keep up with Chrome code churn.
Because just parsing html/xml/some declarative ui description to create a scenegraph and pushing it to the GPU is something I'm sure even native frameworks like Qt do.
Yet I can feel the latency in vs code vs. say sublime text.
It's tempting to blame the huge js blobs trying to create an application abstraction over a document object model but i feel like there should be more to it than just that...