News for hackers. Stuff that matters.
Re:Doing work locally minimizes problems with Electron apps by Sahhaese on Tuesday June 25, 2019 @10:39AM (#20274643)
I'm not an electron hater, but when only using 300mb of memory while idle is something to boast about, they may have a point.
Re:Doing work locally minimizes problems with Electron apps by CharlesW on Tuesday June 25, 2019 @10:46AM (#20274723)
It's relative. Outlook is using 2.37 GB of RAM as I type this.
Re:Doing work locally minimizes problems with Electron apps by jeroenhd on Tuesday June 25, 2019 @10:58AM (#20274866)
That too is relative. My copy of Thunderbird with 6 open emails from six open mailboxes is consuming about 170MB of memory right now, and that's hosting a fully-featured browser to view emails.

Granted, that's reserved memory, but that's the only memory you really need to worry about anyway.

Of course, native doesn't make a program automatically use less RAM. It does start with a lower footprint through, meaning that you can keep an eye on memory usage without relying on ugly hacks in your code.

Re:Doing work locally minimizes problems with Electron apps by Sahhaese on Tuesday June 25, 2019 @10:55AM (#20274828)
That's odd, OUTLOOK.EXE is using 44MB of ram as I type this and has been open for 7 hours.
Re:Doing work locally minimizes problems with Electron apps by LandR on Tuesday June 25, 2019 @11:00AM (#20274902)
Same here, Outlook has been open from 9am > 4pm and it's using 64MB.
Re:Doing work locally minimizes problems with Electron apps by GrinningFool on Tuesday June 25, 2019 @12:18PM (#20275741)
Is it minimized? IIRC on Windows, when an application is minimized the working set is trimmed which can result in a significant reduction - but it jumps back up when you start using the application again.
Re:Doing work locally minimizes problems with Electron apps by toyg on Tuesday June 25, 2019 @11:19AM (#20275109)
Maybe a Mac. My Outlook on mac is idling at 150MB.
Re:Doing work locally minimizes problems with Electron apps by CharlesW on Tuesday June 25, 2019 @12:57PM (#20276252)
Yes, this is Office 365 on macOS. Neither the computer nor Outlook have been restarted in weeks, which is surely contributing to its current RAM footprint.
Re:Doing work locally minimizes problems with Electron apps by Yetanfou on Tuesday June 25, 2019 @11:35AM (#20275282)

   $ ps -eo rss,cmd |grep claws-mail|grep -v grep
   36016 claws-mail
37 MB, 4 accounts open, one of them holding ~10.000 messages (i.e. which need to be archived but it not being my account I'm not the one to do so)
Re:Doing work locally minimizes problems with Electron apps by hackerooo on Tuesday June 25, 2019 @12:18PM (#20275731)
Amazing. You must be 100 times more productive than the parent above whose mail app uses 2300 MB. You must be able to do soooo much more with such efficient tools.
Re:Doing work locally minimizes problems with Electron apps by dang on Wednesday June 26, 2019 @03:02AM (#20282522)
Could you please follow the site guidelines so we don't have to ban you again?

https://news.ycombinator.com/newsguidelines.html

Re:Doing work locally minimizes problems with Electron apps by ionised on Tuesday June 25, 2019 @12:05PM (#20275585)
It's not relative at all. That's just awful.
Re:Doing work locally minimizes problems with Electron apps by CharlesW on Tuesday June 25, 2019 @12:58PM (#20276268)
Is it? Google Chrome and its associated process are using 5.1 GB of RAM. That's why it's tough for me personally to get worked up about 300 MB.
Re:Doing work locally minimizes problems with Electron apps by jcelerier on Tuesday June 25, 2019 @05:37PM (#20279238)
most people have computers with 4gb of ram
Re:Doing work locally minimizes problems with Electron apps by ionised on Tuesday June 25, 2019 @07:06PM (#20280139)
This.

Developers shouldn't be assuming that their users will have machines even close to theirs spec-wise.

Re:Doing work locally minimizes problems with Electron apps by ionised on Tuesday June 25, 2019 @07:03PM (#20280098)
And yet my Firefox with 48 open tabs and a bunch of addons is currently sitting at 1.2GB.

Chrome is awful with resource usage to begin with, which is why Electron is, it bundles and runs a headless Chrome for each Electron app.

Re:Doing work locally minimizes problems with Electron apps by amiga-workbench on Tuesday June 25, 2019 @11:03AM (#20274939)
Is that supposed to be acceptable?
Re:Doing work locally minimizes problems with Electron apps by CharlesW on Tuesday June 25, 2019 @03:28PM (#20277932)
It's not a judgement either way. I'm just noting that apps like Outlook and Chrome can eat GB of RAM, so Electron's overhead isn't a huge deal for me personally.
Re:Doing work locally minimizes problems with Electron apps by opportune on Tuesday June 25, 2019 @09:03PM (#20280948)
My outlook is using 183MB. Meanwhile, Spotify (an electron app) is using 467MB.
Re:Doing work locally minimizes problems with Electron apps by jlongster on Tuesday June 25, 2019 @10:43AM (#20274685)
Did you read the article? It says 230MB for starters, you're clearly trying to paint it negatively. And the first thing it says after that is "still not ideal". Looking around at other native apps and at rest they are consuming between 150-200MB.

It goes on to say that there's a memory-intensive piece that I haven't even optimized yet and will rewrite into Rust which should bring the memory down a lot more.

Re:Doing work locally minimizes problems with Electron apps by dang on Wednesday June 26, 2019 @03:03AM (#20282523)
"Please don't comment on whether someone read an article. "Did you even read the article? It mentions that" can be shortened to "The article mentions that.""

https://news.ycombinator.com/newsguidelines.html

Re:Doing work locally minimizes problems with Electron apps by coldtea on Tuesday June 25, 2019 @01:26PM (#20276600)
>Did you read the article? It says 230MB for starters, you're clearly trying to paint it negatively. And the first thing it says after that is "still not ideal". Looking around at other native apps and at rest they are consuming between 150-200MB.

You're not making it any better...

Re:Doing work locally minimizes problems with Electron apps by weego on Tuesday June 25, 2019 @10:48AM (#20274741)
Making electron, the entire point of which was to lower the barrier to entry to app development, even vaguely reasonable in terms of memory use by having to code in Rust which is very much not low barrier to entry is an irony that strikes exactly to the heart of the point the person was making.
Re:Doing work locally minimizes problems with Electron apps by jlongster on Tuesday June 25, 2019 @10:51AM (#20274780)
I don't get what you are saying. Using 230MB of memory for a very data-heavy app is already somewhat reasonable, and more advanced optimizations are going to require more advanced engineering.

It's the same thing with any app, as you go further along development you will want to optimize in more advanced ways.

I'm not arguing that Electron doesn't have bloat though: https://news.ycombinator.com/item?id=20274725

Re:Doing work locally minimizes problems with Electron apps by Scarbutt on Tuesday June 25, 2019 @12:35PM (#20275955)
I don't understand how is this a "data-heavy" app? You are implying that most of those 230MB is data?

I mean, how much data can a user for a personal finance app store in a year?

Re:Doing work locally minimizes problems with Electron apps by fjp on Tuesday June 25, 2019 @03:40PM (#20278054)
Every single transaction on every account they have for starters, plus a data point for the total in the account at the end of each day I would imagine, plus all metadata you could ever want to associated with a transaction
Re:Doing work locally minimizes problems with Electron apps by _dps on Tuesday June 25, 2019 @04:21PM (#20278475)
Ballpark: say 16 8-byte fields for each transaction and 128 transactions per day, 30 years of transactions is ~180MB.

(to be clear I consider this a very generous estimate of how big this could possibly get)

Re:Doing work locally minimizes problems with Electron apps by derefr on Tuesday June 25, 2019 @11:14AM (#20275056)
Electron lowers the barrier-to-entry for frontend app development. Or, more cynically: Electron allows you to hire cheaper, less-experienced frontend engineers.

A background worker in an Electron process, however, can be thought of (depending on what it’s used for) as more of a “local ambassador of the server”, and thus isn’t really “frontend” at all. It lands on the client, sure, but it’s no more frontend than the client-side half of the Firebase library is frontend. It’s plumbing, and so it’d be the responsibility of a backend or infrastructure engineer to write and maintain.

If you take this perspective, you still receive the main practical advantage that the system’s product manager was probably seeking by choosing Electron in the first place: the ability to hire inexperienced engineers to do UX tweaks, freeing up the senior engineers’ time to handle the hard stuff.

UX tweaks won’t generally bubble down to the level of needing to modify the background worker (again, depending on how you’ve written the thing), so your [junior] frontend engineers won’t need to touch the background worker, so it can be written in a language more on the “good engineering” side of the spectrum than the “low barrier to entry” side—like Rust—without that causing you any headaches of the “everybody who knows how to fix it is busy” variety.

Re:Doing work locally minimizes problems with Electron apps by egeozcan on Tuesday June 25, 2019 @12:32PM (#20275908)
> Electron allows you to hire cheaper, less-experienced frontend engineers.

Do you mean that the front end developers are cheaper or you mean even the less experienced can code in Electron? I have issue with both but I need to understand what you mean first.

Re:Doing work locally minimizes problems with Electron apps by derefr on Tuesday June 25, 2019 @12:54PM (#20276204)
I mean that you can hire developers who, due to their inexperience, know just enough to make one very specific kind of thing, and that thing is a certain type of SPA frontend (e.g. "React developers", sort of like "Java developers"). Because they only have this one skill, and because "web SPA frontend developer" is in-demand enough for a decent supply pipeline of them to have formed (of "code bootcamps" et al), the junior ones are relatively cheap to hire.

You can then have someone with more experience "box up" that web SPA frontend in an Electron wrapper, in a way that will generally last a good while.

(This is, AFAIK, precisely the approach taken by teams like Spotify, where the Electron app has no extra functionality beyond what you'd get from the web app.)

Of course, developers generally age out of only having one skill, so this is sort of the programming equivalent of an "intern job": not something anyone would stay in for more than the length of an internship, and something that you just constantly pump new people through.

Re:Doing work locally minimizes problems with Electron apps by egeozcan on Tuesday June 25, 2019 @01:42PM (#20276768)
Aha, sorry I have totally misinterpreted that then, here's an up-vote :) I sort of got super sensitive when it comes to people underrating the huge amount of skills that are required to be a front-end developer.
Re:Doing work locally minimizes problems with Electron apps by loljabab on Tuesday June 25, 2019 @10:46AM (#20274729)
Its interesting that slack takes 1gb+ memory. Slack still uses the OS provided webview, right? That seems like the right way to do it (last time I used Slack, it was a 3mb download - glorious), but how is it using so much RAM? maybe its leaky?
Re:Doing work locally minimizes problems with Electron apps by danShumway on Tuesday June 25, 2019 @11:17AM (#20275088)
As someone who uses Slack only in the browser and not as a native app, Electron is not the reason Slack is slow.

Electron doesn't help, of course.

But Slack seems to either cache a lot of stuff, or have memory leaks, or something. It's weird, because Slack seems to re-fetch data whenever I switch rooms, so I'm not sure what all that RAM is being used for.

Re:Doing work locally minimizes problems with Electron apps by wlesieutre on Tuesday June 25, 2019 @11:06AM (#20274963)
Electron ships its own Chromium-based browser view. Using the OS provided one does sound like an efficient option, but then you have to deal with all the same compatibility testing (different browsers, different releases, running under different OSes and OS releases) that makes web development suck. It's trying to provide a web-based stack while abstracting away most of those headaches.

It also provides some Chrome specific functionality (loading Chrome extensions) that wouldn't work in an engine-agnostic system, though I don't imagine this is a commonly used mechanism. Extensions are more useful for shoving your own functionality into someone else's webpage, if you control the whole codebase surely it's not the best way to do anything.

https://electronjs.org/docs/api/browser-window#browserwindow...

Re:Doing work locally minimizes problems with Electron apps by monksy on Tuesday June 25, 2019 @11:16AM (#20275066)
> but then you have to deal with all the same compatibility testing

Which means they choose the wrong way to go about creating an app. If you have to bundle a huge secondary app just to run your main application, you've done something wrong.

Re:Doing work locally minimizes problems with Electron apps by coldtea on Tuesday June 25, 2019 @01:28PM (#20276620)
If you have a multi-billion valuation while doing it, and millions of users, you could not care less...
Re:Doing work locally minimizes problems with Electron apps by jlongster on Tuesday June 25, 2019 @10:49AM (#20274760)
My guess is Slack likes to keep pages around, and each workspace is a separate page that are individually pretty heavy. So if I'm logged into 4-5 workspaces that adds up quick.

Slack does not use the OS webview, it is Electron. I don't think it's a 3MB download - if it is it must just be an installer that installs the real thing? I haven't looked recently.

Re:Doing work locally minimizes problems with Electron apps by loljabab on Tuesday June 25, 2019 @11:01AM (#20274911)
It has been years so youre probably right. Bummer. That explains the ram usage.

I do prefer the webview approach because I don’t need/want my chat app to bundle a browser :-/ Ive been a web and native app dev for a decade and do not agree that developer convenience could ever justify these sorts of choices. My webview backed native apps are all sub 1mb and I have no trouble developing them. I guess I just dont get it.

Re:Doing work locally minimizes problems with Electron apps by butteroverflow on Tuesday June 25, 2019 @10:51AM (#20274777)
Are you sure those 3 MB were not just a web installer?
Re:Doing work locally minimizes problems with Electron apps by krzyk on Tuesday June 25, 2019 @12:03PM (#20275554)
Not every OS has a "provided webview", Linux doesn't, not sure if MacOS does.
Re:Doing work locally minimizes problems with Electron apps by mthoms on Tuesday June 25, 2019 @12:48PM (#20276108)
MacOS does (WKWebView)
Re:Doing work locally minimizes problems with Electron apps by yjftsjthsd-h on Tuesday June 25, 2019 @01:40PM (#20276750)
Doesn't it? I would say that WebKitGTK counts.
Re:Doing work locally minimizes problems with Electron apps by krzyk on Wednesday June 26, 2019 @05:03PM (#20289168)
You need to install it first, there are multiple Linux distributions