
Ask HN: Is Electron really that bad for desktop apps? - anoncoward1234
I&#x27;ve been thinking of making a desktop app, but I keep hearing all this chatter about how Electron is really hard on memory. On the other hand, I know webdev, and learning C++ to make a native webapp seems like a steep learning curve (say by using something like Qt). Not only would I have to make different versions of the app for different operating systems, but I would also have to style the app using C++ which seems like a nightmare. CSS&#x2F;js styling is so nice in comparison.<p>Is Electron really that bad? If so, are there any good alternatives that solve the two issues I mention above?
======
stephenr
> CSS/js styling is so nice in comparison.

This is half the problem with Electron apps. I know perhaps Windows users are
used to the random bullshit UI every developer comes up with (heck even
Microsoft between it's own different software), but macOS users generally get
very consistent UI's from native applications. Whatever you create using CSS
is _not_ going to fit in with that. If you need your app to be some special
snowflake of UI design to stand out, it sounds like the actual functionality
of it is commonplace or marginally different at best.

Also consider usability/accessibility. A native (i.e. Cocoa) macOS app gets
_lots_ of accessibility features 'for free'. I've heard it's _possible_ to
provide some/all of the same via Electron, but that its more work, and it's
not done by default because it hurts performance _even more_ than regular
Electron apps.

Your argument about your reasons is literally the argument people use
_against_ the concept of Electron. "I want to do this, but I dont know how..
can I take a giant shortcut, and expect no repercussions?".

Electron is like those old Road Runner cartoons, where Wile E Coyote orders a
"DIY Rocket" from ACME Corp, and sure enough, blows himself up.

If you know web dev, make a web app. If you want to make a native app, learn
C/C++/Swift/ObjC/Java whatever.

Edit: I will clarify this with context. I _do not_ write native applications.
I have written a very quick (like, ~1-2 days total dev time) Cordova/PhoneGap
app using similar tech, as an internal data-capture solution for people on a
project (at the time, Safari on iOS didn't allow browsers to upload photos,
and we needed to capture a lot of images quickly from our team on location, so
I wrote a simple phone gap app and backend server, ran it from my laptop and
installed the iOS apps from my laptop - it was _never_ intended to be
distributed)

So, that is _one_ situation where Electron-type apps might be acceptable - if
you need to do something _quickly_ for an internal project, where a native
browser doesn't give you the API, but Electron does. But Thats a lot of
qualifiers, and you wouldn't be asking about it here if that was your
intention, I imagine.

------
rococode
I think it's important to consider what your program is going to do. Discord,
for example, uses Electron, and I'm perfectly happy with it (as are most of
the millions of others who use it). It's a product with a lot of functionality
and it makes sense for it to have slower startup times, higher distribution
size, and more memory usage. But if you're planning to make a calculator, then
Electron probably isn't the right tool.

That being said, I think the styling thing is a really important point that is
often undervalued. I've written UIs in GTK, Qt, and Swing, and perhaps this is
close-minded but I honestly can't take anyone who says that they're just as
easy as HTML/CSS seriously. I mean, literally just look at how many beautiful
websites are out there, and then how many beautiful, not just functional,
native programs there are (in my opinion, very few). UX/UI is important, and I
think not having to pull your hair out every time you want to move a button to
the right 3 pixels and give it a prettier border is a big plus for Electron.

~~~
SahAssar
Discord, Slack and other chat apps are the perfect example of when not to use
electron. They should just be webapps.

~~~
bananicorn
In fact, I think The Discord desktop client versus Ripcord[0] illustrates
nicely how much better a native solution can run.

[0] [https://cancel.fm/ripcord/](https://cancel.fm/ripcord/)

------
oldcynic
Depends.

I've downloaded a fair number of Electron apps, and ultimately deleted or
aborted the download of most of them. VSC is the one that currently survives.

If it's something that _needs_ most of a browser and HTML - like an email
client that cropped up as a Show HN recently, or a client for a wholly online
service, Electron may be the right choice.

If it's something more trivial like a notepad, reminder, or timer, Electron is
just needlessly making it unfriendly thanks to start time, and memory load.
Multiple MBs shouldn't be necessary for a timer or calculator but Electron
will make that so.

You may say that we have lots of memory these days, and we do. But I run lots
of things these days, and if I have half a dozen such apps running in
background I basically have half a dozen instances of Chrome. That's quite an
extra load on memory and start times. It's also going to be one of the early
casualties if my (or family tech support) laptop is starting to run low on
memory.

Last, I think there is something to be said for Electron as an early version
while testing, especially while still exploring UI and feature changes as you
can focus on that not platform issues. Once you know _what_ is needed, 9 times
out of 10, give them a proper native program.

~~~
stephenr
> If it's something that needs most of a browser and HTML - like an email
> client that cropped up as a Show HN recently, or a client for a wholly
> online service, Electron may be the right choice.

I disagree. These are cases where it's _especially_ bad to use a HTML view as
the application UI.

If your application is essentially a HTML page, and it's meant to render
content from a foreign source, which is also HTML, JavaScript, what have you -
how do you do that? An IFRAME?

You _know_ that Electron apps have _lower_ security sandboxing than a regular
web browser _right_? Who in their right mind would use a web browser to render
a html page as the UI of a web browser, and hope that the foreign source page
doesn't break out of it's rendered context, to influence the appearance or
routines of the 'browser' that loaded it?

------
navjack27
As a user, I can't stand electron based apps. I want normal ass UI on my
programs. In fact, on my desktop, nothing is an app, it's a program... Make
your thing a program.

~~~
cliocg
Your distinction between an app (short for ”application”) and program is
highly confusing.

~~~
navjack27
Exactly

------
kbumsik
Firtstly writing Qt desktop apps in Python is pretty popular so we don’t need
to stick with C++ to write Qt app.

It is hard to understand people cares about memory useage when desktops
nowadays have a lot of RAM. What average Electron apps annoys me is their
constant high CPU load. Some apps take ~10% of CPU load all the time.

I think Electron itself is fine. Look at VS Code. It is fast even though it is
written in Electron. The real problem is the bad habits of average Electron
apps developers. The Electron devs usually come from Web where users can just
press a refresh button or close it when browsers are slow. They don’t care
about optimizing stuff.

~~~
neilalexander
> It is hard to understand people cares about memory useage when desktops
> nowadays have a lot of RAM. What average Electron apps annoys me is their
> constant high CPU load. Some apps take ~10% of CPU load all the time.

The problem with the RAM consumption is not when you run a single Electron app
in isolation, it's when you try and run a few of them and suddenly you're
running hundreds of Chrome threads and you've used 8GB RAM.

------
hajile
React native for desktop has my attention.

[https://proton-native.js.org/#/](https://proton-native.js.org/#/)

------
isaiahg
I've made desktop apps with electron and you can definitely make a decent one
but it isn't going to be as fast. If it's a simple program it's not bad but if
you're going to do any complicated computation you'll wish you had gone
native. On the other hand, if it's not a complicated app, some people are
going to wonder why this simple app is taking so many resources.

How about a compromise. Instead of c++ why not learn Python instead and use
pyside QT. This was actually what I ended up doing coming from webdev. You
don't get the steep learning curve and can get a lot of the benefits from
native apps. It won't be as fast as C++ but you won't have the overhead of
electron. And besides most apps probably aren't going to need to brute
performance of C++.

------
icc97
I think it depends who your audience is. Everyone I work with is more than
happy to install the Slack electron app, but none of them read HN.

If your intended audience is a 'Show HN' expect to be damned for it. If your
audience spans say Windows and Mac and are technical but perhaps less
technical than HN readers it can be an easy way to extend your web app onto
the desktop.

Also it might depend on whether your app needs to always run in the background
or not. For example I use Pencil [0] for UX mockups, it doesn't bother me that
it's an electron app because I only need it for a few days a month. However
the persistent RAM use of Slack eventually annoyed me enough that I
uninstalled it.

[0]: [http://pencil.evolus.vn/](http://pencil.evolus.vn/)

------
MattyMc
I've built a few Electron apps now, one of which I use quite a bit to track
ticket prices in secondary markets.

It's a great prototyping environment, and people have built businesses around
Electron apps (VSCode is built on Electron, I believe). The apps I've built
are big, kinda slow, and as others have mentioned tend to eat memory.

~~~
scarface74
I'm assuming if you are tracking ticket prices it needs to be connected to the
internet, in that case, why do you need an app instead of just a website?

------
bdoin
No idea about Electron but I am used to desktop application especially in Qt,
With Qt Quick (QML + Javascript) I have been able to make a cross platform
application that runs on all desktop (Linux, Windows, MacOS) and all mobile
(Android, iOS). Yes it requires some effort but it makes a nice result that
seems native on all platform.

------
tonyedgecombe
The first question I'd ask is do you really need to be cross platform? Because
if not you can save yourself a lot of pain by avoiding C++ and Qt and choosing
what's appropriate for the platform (C# on Windows, Swift on macOS).

------
shams93
The evonomics of it are still good but at the same time you can use chromium
as a web view and often that's better. Where I work rather than electron we
use a chromium based webview with a native windows desktop rather than
electron.

------
raquo
Consider Chromium Embedded Framework, or Sciter. These too let you define your
UI with JS/HTML/CSS, but you're not shipping a node.js server with your app,
which makes your app much lighter.

~~~
SahAssar
In that case why not just make a webapp?

~~~
raquo
Because you can still have a "backend" hosted on the user's computer, it just
doesn't have to be node.js, could be something more efficient or powerful or
whatever is needed.

