News for hackers. Stuff that matters.
Re:Electron 4.0.0 by azhenley on Friday December 21, 2018 @11:03AM (#18734119)
I really want to use Electron for a project I have coming up since it checks all the boxes, but all I ever see are complaints about the performance :(

Is the performance really that bad? Plenty of successful applications are using it. Is there a fix in the horizon?

Re:Electron 4.0.0 by jf- on Friday December 21, 2018 @11:22AM (#18734292)
The performance really isn’t that bad at all in my experience. The complaints you see are developer complaints, where they’re talking about resource usage that ordinary users would never notice or question, or UI lag that most users wouldn’t care about (I only add this because someone else in this thread claims to have encountered it, but I never have, or have never noticed). If you find web apps running in chrome to be acceptably performant, then electron is fine for your use case. But naturally, a native solution will be faster if you’re doing something that really is resource intensive.

VS Code is electron, I use VS Code every day without noticing any issues. I think the complaints about electron are moot.

Re:Electron 4.0.0 by weiming on Friday December 21, 2018 @11:38AM (#18734416)
> where they’re talking about resource usage that ordinary users would never notice or question, or UI lag that most users wouldn’t care about

But this is such poor logic. We can notice these things, while regular users just suffer not knowing why their battery drains so quickly, unable to pinpoint the problem.

Re:Electron 4.0.0 by jf- on Friday December 21, 2018 @11:45AM (#18734493)
> But this is such poor logic.

No, it’s not. It’s at most a trade-off. Some developers will doubtless make this their hill to die on, but I suspect it really has nothing to do with performance or battery life, and it’s likely motivated by resistance to web technologies being used on desktop vs what they’re used to.

Also I’d like to see some actual battery life benchmarks for electron, because I don’t imagine that it’s a huge deal, but benchmarks would prove the matter. It also ignores actual desktop users or users who just use mains power all the time.

Re:Electron 4.0.0 by spiralganglion on Friday December 21, 2018 @12:34PM (#18734846)
If you’re on a Mac, open up activity monitor and watch which apps use the most energy. For me, the energy used by Atom, Slack, and Chrome is vastly higher than the energy used by other apps (inc. Safari loaded with tabs). It’s possible to make an energy efficient Electron app — you just need to aggressively shut off event loops when there’s nothing to update, which is hard so most app (and site) devs don’t bother. (I make complex animations on the web, so I’m hyper attuned to perf and energy use)
Re:Electron 4.0.0 by sroussey on Friday December 21, 2018 @03:21PM (#18736279)
That and check if the window is hidden, which was improved a bit in this release.
Re:Electron 4.0.0 by ryacko on Friday December 21, 2018 @01:06PM (#18735149)
I’m curious, do you compile anything to asm.js?
Re:Electron 4.0.0 by spiralganglion on Friday December 21, 2018 @07:11PM (#18737923)
Not yet, though I'm keeping my eye on WASM and will pursue it if the need arises. The sort of work I do has relatively little overhead from the JS, and is mostly bottlenecked by rendering (SVG, mostly). WASM wouldn't help my load/parse times since I rarely ship more than a few Kb of JS, and it wouldn't help my per-frame times or latency because I'm usually done the JS part of the frame in around 1ms.
Re:Electron 4.0.0 by oscargrouch on Friday December 21, 2018 @01:11PM (#18735197)
Take a look at the apps you are executing now.

Now imagine if they were all electron based and therefore consuming 1GB+ each?

Also we need to take into account that it feels slugish and they are not as responsive as other apps, and i guess it has to do with JS VM reaching the tipping point of what it can do and optmize..

Anyway, my main point is that the big problem will happen when you stack those things.. than a computer that should be more than enough, just isn't.

Even the user with low tech awareness, will close the app and feel his computer is working better.. and they will blame the company who makes the app for making their computers feel slugish in the end.

Re:Electron 4.0.0 by jf- on Friday December 21, 2018 @01:18PM (#18735266)
Except that they don’t need to consume 1gb+ and they don’t need to feel sluggish. We’re also not talking about replacing every native app with electron.
Re:Electron 4.0.0 by oscargrouch on Friday December 21, 2018 @02:10PM (#18735696)
> Except that they don’t need to consume 1gb+ and they don’t need to feel sluggish.

The problem is that is built around V8 tied up to Node.js, so i cant see how it will get any better giving V8 is a state-of-the-art VM already very optimized and using little resources as possible. Also you are tied to blink/webkit which together with V8 will consume a good chunk of memory and you as a dev will be unable to optimize further, giving you can use anything other than JS and blink.

> We’re also not talking about replacing every native app with electron.

Of course not. But the problem here is the trend. Companies will see how cheap it is to just reuse cheaper human resources being used to the company web dev, and how fast you can prototype an app.

The other companies who create better products because they care more, will have a hard time competing with the cheap sketchy software that cost less to build, and the worse products will likely win.

Its "the worse is better" all over again.

Re:Electron 4.0.0 by jf- on Friday December 21, 2018 @02:51PM (#18736015)
> The other companies who create better products because they care more, will have a hard time competing with the cheap sketchy software that cost less to build, and the worse products will likely win.

They’re not cheap sketchy products, you keep mischaracterising electron apps so that you have a point.

Let the market decide. If the native apps are superior, then customers will choose them more often and companies will feel the pressure to use them. Unless of course customers don’t care, as I believe, then any argument about their superiority is meaningless.

Re:Electron 4.0.0 by na85 on Friday December 21, 2018 @03:33PM (#18736369)
It's not a free market, though because right now there isn't really a direct competitor to e.g. Slack, because the trade-off of developer convenience vs performance seems to be working in Electron's favour in that nobody else has brought a native competitor to "market".
Re:Electron 4.0.0 by oscargrouch on Friday December 21, 2018 @05:02PM (#18737088)
> They’re not cheap sketchy products, you keep mischaracterising electron apps so that you have a point.

I still have a point even if/when the electron based ones have more quality or are better from the consumer point of view, because my point was not about the final quality of the finished product, but about scale and economics. Im not saying that every electron app will be inferior, this is illogical and unsustainable..

Rather im arguing that the whole model that the Electron represents will flood our desktops and even phone with cheap, memory hog apps, even when some of than are great, collectively they will be a nightmare to our computers. Users will blame the OS, or they will figure it out when they close the Electron apps, seeing their computers working better (And i guess when they get to this they will blame the company that created the product, and the bad word might start to spread).

Even with all the computational power we have now, we will have a even worse user experience than we had in the 90's with very limited computers compared to nowadays.

> Let the market decide. If the native apps are superior, then customers will choose them more often and companies will feel the pressure to use them.

My point being in the end, you wont have any options, and in some cases great products might vanish.

Im very critical of all things Apple, but this is one of the things i think Steve Jobs got right, and no wonder Mac OS and now iPhone worked out as a shield for great products that would not survive in the "worse is better" environment of Windows and the Web.

They are also great, accessible, popular, etc.. But if they were the only game in town a lot of great products would not have survived and others would not have been created. Thats what i fear about if the Electron trend gets too much hyped.. We will move fast and break a lot of great things in between.

If it gets popular, but not the monopolistic kind of popular, then its great, and good that its there as an option. But in tech we use to jump from hype to hype. (And you also can see what im trying to elucidate here by following whats happening in the NoSQL vs SQL database front)

Re:Electron 4.0.0 by jf- on Friday December 21, 2018 @05:53PM (#18737428)
No one is hyping electron Oscar, quite the opposite: HN is ceaselessly negative about it, and for very thin reasons that just don't cut it for me.

I think you do get close to the real reason for this negativity when you say that you're afraid of it - I suspect that electron is threatening to many developers exactly because it has so much potential. It dramatically lowers the bar for access to desktop development, works on all platforms, and if it really catches on (and this is probably worst of all) it renders much of their native development experience useless.

The criticisms that it doesn't automatically look and behave natively and that it is more resource intensive are true, but I don't think they really matter. Developers here seem to be deliberately overstating the case against it in an attempt to make it go away.

Anyway, the argument doesn't matter all that much either. Electron is such a good value proposition from a development standpoint that it'll continue to see growth, and with it further optimisation, and eventually it or a web tech orientated successor will end up being pretty big.

Re:Electron 4.0.0 by ilikehurdles on Friday December 21, 2018 @11:13AM (#18734210)
Try the applications and judge for yourself. There are tons of them. Most people are probably OK with the performance of apps like Spotify, and have never come close to exhausting their memory or disk space. I think being able to use HTML and CSS for layout, but with full access to native APIs, is a huge reason electron keeps winning despite the hn complaints. I’d be happier without it being JavaScript-based, but there are nice languages that compile down to it, like Elm and clojurescript.
Re:Electron 4.0.0 by Royalaid on Friday December 21, 2018 @11:23AM (#18734303)
I would also like to echo this. Yes most of everyone on HN hate Electron and they can point out any number of reasons why it's bad, and they would correct. In spite of the technical problems Electron is still seeing growth and continues to ship in new products.

If you think Electron works for what you need I would say use it and just ship, once you have more resources reevaluate if it is or is not working.

Re:Electron 4.0.0 by bengotow on Friday December 21, 2018 @11:16AM (#18734245)
Well, performance and memory usage are two separate things. Electron's performance is quite good and if your audience is "computer users at large", they won't care at all about the memory usage. I'd say you should almost definitely use it if you want to target Mac + Windows + Linux. Just know that you'll get wrecked on HN ;-)
Re:Electron 4.0.0 by zozbot123 on Friday December 21, 2018 @12:11PM (#18734671)
> if your audience is "computer users at large", they won't care at all about the memory usage

I'm quite sure that you got that backwards. Your dev machine may run Electron apps fine with 16GB RAM, but a huge majority of average folks are on 4GB and often less. And they're already running Windows 10 (or at best OS X) and a web browser with a bunch of open tabs!

Re:Electron 4.0.0 by Camto on Saturday December 22, 2018 @04:02PM (#18742435)
True. My computer just cannot run a web browser and Atom at the same time without freezing for a few seconds every minute or so.
Re:Electron 4.0.0 by kup0 on Friday December 21, 2018 @12:19PM (#18734737)
I used to be an Electron hater, but I realize the problem is less Electron itself, and more has to do with how well it was used to develop the app.

VSCode and Discord to me are notable exceptions, whereas most other Electron apps feel pretty sluggish. They must be doing something right that other devs using Electron are not.

That said, I do still prefer the performance of native apps. Even though VSCode is fast for an Electron app, when I switch back to Sublime Text, I still realize the performance gap is there (especially for launch times, when I'm opening a bunch of small files at once)

Re:Electron 4.0.0 by ionised on Friday December 21, 2018 @11:14AM (#18734226)
Consider that each Electron app runs its own instance of Chromium.

Chromium itself is a memory hog and apps like Slack routinely take up to a gigabyte of memory. For a fucking chat app.

How many Electron apps does the average developer run on his machine now? I'm back-end developer and I still need four or five Electron apps running to do my job.

All in all they are taking up between 4-7Gb of memory. That's just absurd to me, and we are all on 2017 MacBook Pros with 16Gb RAM. Combined with Docker, IntelliJ, Robo3T etc, I'm pushing up against my RAM limit frequently, because Electron apps are all a bloated mess. Every single one of them.

It's even worse if we start getting multiple end-user apps are written with Electron, because the average consumer machine doesn't have a lot of memory like developer machines tend to have.

This kind of development shouldn't be encouraged in my opinion.

Re:Electron 4.0.0 by jwr on Friday December 21, 2018 @11:52AM (#18734551)
The performance complaints are mostly from developers. Users of your application, if it is important to them, will not care.

The big thing about Electron which most developer discussions miss is that it enables low-cost multi-platform development, especially if you already have a web app. In this age when people would like to pay as close to 0 as possible for software, this is important. I have a SaaS app and people keep asking me about apps for iOS, Android and native Mac/Windows. There is no way I could afford to develop+maintain for even one of those platforms. Of course most people who ask about this would like to get the additional platforms for free :-)

Electron makes it possible for me to re-package my app as a native one, with certain benefits (easier file uploads, access to printers and peripherals, etc), and with a reasonable cost.

Re:Electron 4.0.0 by pseudalopex on Friday December 21, 2018 @02:19PM (#18735756)
Less advanced users complain when their computer is slow. Developers know how to locate the problem and that it could be fixed.

Everyone here knows that Electron is the cheapest way to wrap a web app. It's obviously the fastest way for someone with web but not desktop experience to create a minimum viable desktop app. It isn't the only option for low-cost multi-platform development.

You have good reasons for producing a hybrid app instead of a native app. It's questionable whether Slack does.

Re:Electron 4.0.0 by msvan on Friday December 21, 2018 @11:06AM (#18734152)
I don't think it is fixable. Embedding Chromium is going to eat computer resources. This is the price of simple development for the desktop.
Re:Electron 4.0.0 by yroc92 on Friday December 21, 2018 @11:26AM (#18734332)
Slack, Spotify, VS Code, Insomnia and many other apps use it. They use excessive amounts of resources for what they are, but really any modern machine shouldn’t have a problem with it.
Re:Electron 4.0.0 by fabiospampinato on Friday December 21, 2018 @11:57AM (#18734575)
I think Spotify is built using web technologies but not Electron per-se, unless they switched to Electron ~recently?
Re:Electron 4.0.0 by yroc92 on Saturday December 22, 2018 @10:29AM (#18740927)
Yeah not electron, but chromium, etc. I figured it’s a similar end result.