Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

It's worse if we routinely read highly critical message boards like this one. I'm currently developing a desktop app using Electron, but comments like this [1] make me wonder if I should scrap it and start over using purely Rust and/or C++.

[1]: https://news.ycombinator.com/item?id=31350035



Honestly, I say this as a big Rust user: ignore that shit. At the level of writing a desktop app, the truth is that you're already using a vast amount of CPU and memory, and eking out performance gains on that level is not going to make a vast difference. It's very likely that your Rust code would end up being littered with .clone() and the like, and likely less performant than well-written JS.

Also, V8 is an incredible piece of technology, and is not that far off being competitive with Rust or C++. In some scenarios GC (by which I mean tracing) can outperform reference counting, or even Rust-style malloc+free. The event loop architecture is also very naturally fitted to user interfaces.

Ignore the HN opinionmongers and build with whatever tools you can work with. You'll be much faster and more flexible, and you'll gain an understanding of what the bottlenecks are, which you can use to do targeted optimisation later on :)


I find it really fascinating how a completely different subset of Hackernews users answers to you than are present on other threads. As literary no sibling is voicing a dissenting opinion I feel compelled to present it:

Purely from the user perspective I hate electron, because of its RAM usage. The speed argument is a straw man: Of course V8 is fast. And yes, VSCode is a very good IDE. But the problem is real world electron application don't scale down. In my (of course biased) experience even simple electron applications use at least half a gigabyte of RAM, often a whole gigabyte. If you're on a beefy 32gb machine you'll never noticed the difference. But on the 8gb machines most people around me use, these electron apps really take up a huge fraction of RAM. And swapping is definitely noticeable slow, even on SSDs. The "think about the planet" argument comes to play, when I need to upgrade my PC because RAM is the bottleneck. And seriously what fraction of the population even has the knowledge to only upgrade the RAM and not buy a whole new PC.

If I had to advise you personally, I might even tell you to choose electron. But be aware that you are using the "defect" option in the prisoner's dilemma: as everybody around you is choosing the societally harmful option of wasting resources you are at a competitive disadvantage to do the right thing. And also: electron has stolen mind share off of better solutions, so the documentation there is also not in the best place.

And even worse, those people I reach with my argument, and thus put at a competitive disadvantage because they are going the extra mile to do the rights thing, might be those that I want to support the most, because they might be willing to the right (IMO) things at other topics I value as well, like the importance of privacy.

So what is the conclusion? I have no idea how to fix our collective resource waste and it is hard to assign individual responsibility and I'm deeply dissatisfied by the whole situation.


> I find it really fascinating how a completely different subset of Hackernews users answers to you than are present on other threads. As literary no sibling is voicing a dissenting opinion

I suspect the difference is because they are responding from a developer's mindset, not a user's. For devs, Electron really is the easiest way to make desktop apps, especially if one already has web experience. Users who dislike Electron are generally seen as a vocal minority (how many people use Slack or VSCode vs non-Electron variants?). But then you have this vocal minority congregating on HN, which is especially focused on speed, and you get comments like the parent linked, dismissing Electron.

The dev point of view is more prevalent in this thread because the linked article is all about how a dev failed to ship an app because they thought it wasn't good enough, which is exactly the problem Electron solves, even if it's worse for the user.


> For devs, Electron really is the easiest way to make desktop apps

For developers who have never heard of Visual Basic, Delphi, or Free Pascal / Lazarus, Electron really is the easiest way to make desktop apps they know of.

There, FTFY.


I'm gonna be honest, vanishingly few people use any of those technologies these days, and I'm speaking as someone who has used VB and some Delphi before. Electron and JS has magnitudes more libraries and support than all three of those technologies combined.

To think that devs these days should use any of them is to be tone deaf to how the tech world works these days. Good luck convincing a dev, much less their boss, to use Delphi to develop their cutting edge desktop apps.


> Electron and JS has magnitudes more libraries and support than all three of those technologies combined.

Libraries and support for what? Betcha 99 percent are for stuff that 99 percent of developers don't need.

> Good luck convincing a dev, much less their boss, to use Delphi to develop their cutting edge desktop apps.

Wasn't this a discussion about the single bloke working on his Minimum Maybe Viable Product? He's his own boss. And if he doesn't want to be convinced to use the best tools for that -- his problem, not mine. I was just correcting your factual error about the easiest way to make desktop apps.


As it happens, the deciding factor in my choice to use Electron in this particular product is that, thanks to being built on Chromium, Electron includes high-level WebRTC APIs with a complete media stack (including advanced stuff like audio streams from multiple sources). Good luck getting that working in Delphi or Free Pascal.


Bah, dang rich one-percenters looking down on us CRUDdy peons! ;-)


> So what is the conclusion? I have no idea how to fix our collective resource waste and it is hard to assign individual responsibility and I'm deeply dissatisfied by the whole situation.

I think the most likely conclusion is that once OSes are guaranteed to have a modern-enough browser engine (this is close to being true for Windows since they introduced WebView2), Electron could update their framework to use the system's native webview (or at least make it available as an option for the developer). This would bring back the problem of having to test in multiple browsers, but I'd rather test against an old version of Chromium, or even Safari, than have to test against the old Edge engine in WebView1.

Edit: Did some more reading, and the way Electron discusses WebView2 doesn't seem to imply that they're interested in integrating with it: https://www.electronjs.org/blog/webview2

But regardless, I think all it would take is someone else making a framework that uses native webviews and implements enough of Electron's APIs/tooling to be close to a drop-in replacement. (Then again, how many people are using Preact?)


I'm someone who tends to hate on electron, but definitely ignore those comments. If you have a large, experienced team who can easily crank out a native app, then there is potential for increased performance, but for solo projects and small teams the increased productivity alone is worth it. It's way better to have something available than a promised feature that may ship in 2 years.

Plus, there are tons of slow buggy apps that are written in c++, that doesn't guarantee performant software. Electron doesn't need to be slow either, VSCode demonstrates that. Especially for a solo dev or small team, electron is for sure the right choice for a desktop app.

Edit: the reason I tend to dislike electron is that apps don't often follow native UI trends, which is definitely a solvable problem.


"Desktop App" could be anything from a taskbar app with a couple screens, to a CRUD app, to something that plays video, to a screenshot app, to something that only deals with audio, to something that only really needs system dialogs, etc, etc...

Electron works great for some of those use cases.

The other stuff works great for other use cases.

Anyone giving general advice on that is giving bad advice, period.


100%! I had the same fears when I started rewriting a native Mac video editing app in Electron last year, that it would be a big hurdle and that people would hate it. I don’t think that’s actually true anymore outside of our limited tech bubble. I also don’t think it’s necessarily true that “Electron == slow”, especially if you can offload the heavy stuff to native code and use Electron just for the UI.

I switched to using Tauri recently though, with the same sort of architecture - Svelte front end, Rust for the heavy stuff, and it’s working out nicely. It’s actually faster than the Mac app in most ways (and to be fair, Electron worked well too, but the installer size and startup time bugged me)

If you don’t like the bloat of Electron and don’t mind dealing with 2 browser engines instead of 1 (Webview2 + Safari), Tauri is worth a look. Doubly so if you already know some Rust. They’re still a bit early days in some respects, so it depends on what Electron features you need.


Nah, if you do really believe creating what is effectively a web app is faster than a proper desktop one, go ahead and create it.

The only useful recommendation here is that, when you have some time, and don't have to rewrite an entire app, and if you expect to target the desktop again, you will gain from learning desktop frameworks. But absolutely not now while you are on the middle of something.


You have to just ignore software moralizers like that; people who have goals other than solving problems for users in a cost effective way. They aren't common, they're just really loud. There's a reason Electron is incredibly popular and it's not because the developers are stupid or careless.


I couldn't imagine building a desktop app with anything other than Electron these days UNLESS I had significant prior experience with some other toolchain.


Ignore that! I mean I do hope Electron one day adds performance tuning knobs, to disable some browser behaviours so you as a dev can speed up the electron app. But yeah use what you want. I would use it for desktop (I would probably just wrap a web app in it, 2 for 1)


As Charm would say: "haters > /dev/null". Build what you want!


“talk to the hand” in pre computer speak I guess!




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: