Hacker News new | ask | show | jobs
by kenhwang 3041 days ago
Or maybe the other way around: what if a browser was modular down to the feature level? Don't use CSS/JS/HTML feature X/Y/Z? It's removed from the engine at compile time. That way you're only shipping what you're using, not a mini-OS.

Or maybe the JVM approach, where there's one electron process on the system, and all the electron apps on the system are run in the same process. That way at least the rendering/JS engine can be shared. It'd be like Firefox before electrolysis. Though, having your chat client crash and also take down your music player and code editor seems like a terrible user experience.

1 comments

One big problem with Electron apps today IMO is that different apps cannot share memory, even though 90% of them is the same (Chrome/V8 etc).

That would be solved if you had one Electron binary that started each app, much like a JVM. They would still be different processes so one app couldn't bring down another, but at least they would share memory pages and copy on write which would make the multi-electron-app world better. (IMO)

It would also have the benefit that you could update once and not run an old chat app with old Chrome security issues, until each developer decides to update Electron. But I guess the argument against that is that it's no longer "truly cross platform" since an Electron app may have to support multiple Electron versions. This is how things always have been though, developers just seem a lot more lazy about it nowadays.

I'm not sure you would save that much memory. It would be a similar situation to having Chrome open with a bunch of tabs (those are separate processes as well) - it's the tabs themselves that consume most of the memory, compared to "bare" Chrome.
On my computer, "bare" Chrome with 0 tabs open still uses ~100MB of memory. If Electron would just use 100MB for the base compared to 100 * number of open Electron apps, that's still a pretty big win in my book.