Doing work locally minimizes problems with Electron apps
jlongster.com
jlongster.com
I see it as a stop-gap until I can invest more resources into something more lean. But I'm focused on the product right now, not rewriting the world and wasting time because of engineering ideals.
Slack is the best example. An app that just 'works' in Electron and the stop-gap became the permanent solution for eternity et voila -> still huge valuation and IPO.
I am afraid once you go Electron, most will stay Electron.
However, if something were to come along that uses the user's local webview instead and provided a way to bundle a node server with it, I could absolutely switch to it.
In fact, I've played with the idea of providing an app that only sits in your menubar and runs the server, and opening the app just opens a tab in your browser. But most users don't care as much about all this as we think and would find that odd.
You're right though - if something is working well enough it probably will end up sticking. Slack just goes to show that it's probably Good Enough despite what we feel about it.
That only deals with memory and disk use though. CPU and battery use under 'load' will still be through the roof compared to native apps. I put load in quotes because even entering text or scrolling creates massive energy consumption spikes on Electron. Oh and your UI will still be sluggish too.
To be clear: I'm not hating on your app or choice of Electron, just be aware most of the drawbacks are here to stay. Even Microsoft with all their engineering prowess can't seem to fix them (see VScode vs Sublime), and they are already using a heavily customized and optimized Electron.
A big part of why Electron-likes have succeeded so widely where those did not is because they suffered from absolutely massive fragmentation, both in features and in performance/bugs. Electron (comparatively) does not, because it bundles its own full stack. You have to deal with upgrades to it when you choose to do so, but not "everyone simultaneously has a different version of their webview, many of which you have never seen and cannot reproduce, and you always have to deal with them all".
Solved by https://github.com/GoogleChromeLabs/carlo
I'm not aware if Cordova or ionic capacitor has the feature.
here's a todomvc in it : https://github.com/jcelerier/TodoMVC-QML :)
QML is already JS (ES7) so you can code your logic in it (though 95% of people opt for doing it in C++ both for the speed and the static typing). Sure, there's no SASS but I would argue that the QML offering is much clearer than CSS - http://qmlbook.github.io/ch04-qmlstart/qmlstart.html.
[0]https://github.com/yoDon/electron-dotnet [1]https://github.com/yoDon/electron-python
Given their BUILD talk, with comparisons against Electron hungry resource usage, it wouldn't surprise me if VSCode eventually migrates to React Native.
Native cross platform apps built using the react paradigm written in reasonml/ocaml
And the vim based text editor being built using it: https://github.com/onivim/oni2
As long as you don't block in the main process and take advantage of Promises and even WebWorkers, why is another dedicated process needed?
It's that they're quite non-native. And not just in the "button borders are 1 pixel wider than usual" sense -- they're usually styled to resemble web applications, with big data views, Material UI, etc.
Going from this to something more lightweight/native doesn't just require a different API, it requires a completely redesign.
In other words: The Big Rewrite That We're Definitely Going To Do Someday(tm).
It's a balance - personally I think apps that focus on a specific platform is exclusionary. So accepting some non-native feel means more people can use my app.
I agree that browsers make it hard though.
This won't matter as much for rich-text chat apps or the like, which always looked horribly non-native, over-styled, skeuomorphic (cf. Trillian)…
But let's picture a database client or IDE. Those used to resemble regular desktop apps. Nowadays?
Note that I'm not arguing about your article or even approach, I was just chiming in on the dislike for Electron in general, where I think bloat is the least of our worries. All this wasn't something new, the downturn of desktop UIs started way before, as people are now used to mobile and webapps and expect that kind of look and feel everywhere. The OS manufacturers definitely seem to approve and comply.
You saw this happening in other places, before. Just look at enterprise Windows applications that were targeted to people used to terminal UIs (3270, VT220). Current UI trends are the same, just with spurious rounded corners instead of closely-grouped form elements…
The result for most users is that they use a whole medley of different UIs daily and are far more flexible about UIs than back in the day when you were either a Mac person or a Windows person exclusively and all of your apps were native apps on your one machine. As clients continue to diversify, as Web apps spread, as companies like Apple keep bumping the Mac UI to lower and lower priority and claim Mac (which mustn't have touch)/iPod/iPhone/AppleWatch all need different UIs and all must have some sort of web support, and Google, Facebook, Twitter, and Amazon apps in their wide and ever-changing variety are used more and more...the demand for consistent UI in the fine details is not nearly as big an issue for most people as it used to be.
Of course, if every app out there was perfectly consistent, then perhaps it would be a different story.
This is the worst thing in computers. Why would you EVER _block_ the ability to select text? I am engaged enough to want to select something you made! Embrace that, don't stop it!
Imagine what it would be like if a click and drag on a window title bar moved the window but a click and drag on the text part of the title bar just selected text.
Back in the Amiga days there was a nice little app that let you go into selection mode and then draw a rect around anything and it would pseudo-ocr it. Surely something like that exists on current machines, but I havn't seen it.
Another example are tables that have selection boxes for records or “action” links in each row like print or view. If I could select this table without those columns coming along for the copy ride I’d cut at least one if not a few steps out for every time I copy/paste something.
Examples: the text in a menu item, the text in a button, the Unicode x in a close icon, the bar between menus.
This is really noticeable in a few web applications where you can select the wrong thing and it interferes severely with using the UI (I have experienced this with Windows and Android).
Yes, you usually want to be able to select the main text. However many mobile UI frameworks just disable all selection, because that is the easiest way to also disable selection within UI controls (managing this issue is actually quite difficult from my experience writing a HTML UI framework).
Good HTML UI frameworks don't make this mistake.
For example I use Visual Studio Code every day and the UI seems pretty good to me (panels, menus, tabs, check boxes, combos etc). I am presuming it uses a component framework (although I admit I haven't looked at the source).
So don't always allow selecting everything. If you start your selection inside "content", constrain to content, don't select labels. If you start on a label, select labels and maybe content too.
Native apps do this all the time in small degrees, people are used to it: "select all" selects content, not chrome, and it's context-sensitive in many cases (e.g. select all in a folder doesn't select parent folders even if they're visible).
Don't block selection please.
On the other hand, getting people to copy what they see rather than read it out loud incorrectly can, pretty often, cut several rounds of back-and-forth out of remote tech support. It seems insane because it is, but yes - copying text in a button rather than having them say "I clicked the yes button" (when no such button exists) is a useful feature.
VSCode and Atom both look great and they're non-native. I also think Slack looks pretty good too. Except for MacOS, native UI widgets generally seem to be pretty ugly.
Even Microsoft is embracing non-native UI for its own Microsoft Office platform.
Web-apps/material design, look sexy.
I think there's a threshold for this.
Throw 1 or 2 non-native designs (and UX) at me, I'm fine. I'll appreciate the aesthetics. Make every app have its own UX/design and I'm going to get lost very easily.
And there's a hidden context switch cost there that can accumulate.
The most bloated Tcl/Tk runtime I could find (undroidwish tcl/tk running on SDL + OpenGL and Anti-grain backend) is 23 Mb of disk space and 42 Mb of ram (including all the shared libraries).
Hard to compare with a web engine in functionality and ram usage.
I decided to try some example apps instead, so downloaded some .kit files and tried to run them:
% ./tclkit-8.6.3-macosx10.5-ix86+x86_64 fractal.kit 2019-06-25 12:14:12.541 tclkit-8.6.3-macosx10.5-ix86+x86_64[18970:1942703] -[TKWindow setCanCycle:]: unrecognized selector sent to instance 0x10023a910 2019-06-25 12:14:12.542 tclkit-8.6.3-macosx10.5-ix86+x86_64[18970:1942703] * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[TKWindow setCanCycle:]: unrecognized selector sent to instance 0x10023a910'
It crashes.
Hard to compare with the ecosystem and maturity of the web.
If we're comparing UI implementation languages, it doesn't look good from a historic perspective. PostScript was pretty much better than all its successors. Tcl/Tk had a decent approach as something Unix-y, and I don't even want to know what will come after JS/CSS/HTML if we're continuing that arc.
I do believe that a well-designed UI makes a difference, whether users realize it consciously or not.
I am not sure whether how much an app stick to OS "native" idioms is actually significant for a well-designed UI in 2019; I think users don't spend enough time off the web to be used to those idioms anyway.
What if the way most people use their computers/devices now, sticking to a standard "OS native" design language simply doesn't benefit them.
Then if it takes you more time/money to do so, that is time/money spent without actually helping anyone, when you could have been working on something that did. I'm not even talking about "helping your startup succeed", I mean literally, helping the users.
Design matters, I'm a big believer in that. But you've got to design for your actual users in the actual world they are in, designing for the world you wish you had with the users behaving how you wished they behave... is the programmer's fallacy.
I think it's a legitimate question, does an app "behaving native" (as far as UI/UX elements and the OS design patterns) actually help the users? Or do we just imagine/wish it would? Does it actually matter? Does it actually benefit real people users in the actual world?
Maybe. I'm not sure it doesn't. But I'm suspicious enough to ask.
Hmm... does an application behaving according to the UX language of the rest of the system actually benefit the people using that system? Let me think about that.
Nothing about the current trends in UI design are about a better experience for the user. Nothing. Ask anyone who relies on accessibility features, for instance. I'm sure we all love hijacked scrolling, pop-in content, pop-up boxes, etc. which is why they're there right?
No, as usual users are just resigned to putting up with the bullshit that crappy developers deliver to them, and it is getting easier over time as they forget that things used to be better.
You're not designing for users, you're designing for money, so at least take responsibility for making shit suck so you can put food on the table.
An article written by a blind programmer[1] was posted on HN a while ago, and he said he uses Notepad++ because it's a native applications and plays nice with screen reader.
[1] https://www.vincit.fi/en/blog/software-development-450-words...
The answer is of course, no. Unless your target audience is already technically-minded people, most users will struggle the same and simply do not internalize the "UX language of a system", only noticing when the departures are huge.
Examples of such departures that can actually make a noticeable dent on the average users' productivity with software are:
- the move from classic menu -> ribbon menu
- single desktop -> multiple desktop
- stacked windows -> tiling by default
Examples of changes that do not affect anyone's productivity but annoy UI purists:
- Input doesn't glow the same way native input does when selected
- OK and cancel swapped places or are aligned to the other side (I'll grant you the importance of swapped buttons if they pretend to look native)
- The menus are behind the titlebar instead of using the global menu
- Using a custom set of icons for standard behavior
- Hierarchy of background colors is not respected
- It's using the horrible Qt file picker again
All of this is coming from an UI purist that has seen how cross-platform development looks like. Having a good language design that is good enough for all targets requires work to come up to but is well-treaded ground (and there are many already out there you can just copy). Alternatively, having 3 codebases for the same app multiplies the cost of frontend development by anywhere from 1.5x to 3x depending on the feature and architecture and that is simply absurd for the overhwelming majority of applications given all options.
To be fair, nobody cares. And I'm not just being snide.
One of the social apps proudly wore it's "hard to use" interface as a way to scare off the grownups.
And, personally, I'd rather have an app that scales it's interface elements nicely rather than the "detents" that we get at particular monitor resolution (Try scaling something like Reaper (They're not the only ones) to anything other than 2x on a 4K monitor--Umm, if I wanted a 1920x1080 monitor, I'd have bought one, thanks. What I want is for you to scale to about 150% so that I get more screen elements AND they're larger).
Add the fact that "screencasting" is much easier if the application renders all its elements, and you've got a lot of reasons to go non-native and never look back.
I think people do care, but they don't know what they dislike.
I mean, there are certain things we tolerate on the web, like a UI taking a while to load. We don't tolerate that in native apps — even if the content is missing, I still expect the interface to show up instantly.
It's not a question of native vs web apps. It's a question of "does this fulfil the expectations I set for native apps?"
My position is that frameworks like Electron and React Native aren't amenable to fulfilling those expectations but they are capable of doing so if the developers put in the extra work. It's just a shame that so many developers don't, and their sloppy efforts become the poster children for these web apps.
At the same time, my position is also that if you're going to put in that extra work to make web apps feel right natively, you could probably have done native UIs to start with.
What we should be discussing is providing the functionality of Electron without the cost. A protocol that behaves like React native. Ideally a spec, which any language can implement and provide a native UX to the end user.
Some projects try (ProtonNative, for example), but I've not seen one go quite far enough. I don't want to be forced to write a JS app to get benefits here. After all, with ReactNative, it's basically a process RPC to a bunch of widgets. `process <-> UI`. So why be forced to write JS? An open spec would do wonders here.
I've not invested cycles on solving this problem, of course. Yet I can't help but wonder why so many people are focused on solving UI issues with very narrow solutions like Electron, ReactNative, ProtonNative and so forth. They're great projects, but a slightly wider vision would make them amazing projects.
Thoughts? Am I missing something obvious?
I also used it to build the kind of bridge you mention, it was for dynamically build gui for cli apps that did job processing (but it was a basic bridge with few functionality), and also some crud form from the database schema.
Although most major Electron apps are written in node, it's pretty easy to have a backend in another (compiled) language. You can simply use the subprocess module in node and build your own bridge, for example to a Go CLI that accepts events from electron and does whatever you want it to do. It's a workaround for sure, but the point is you could do it in a pretty stable way.
>After all, with ReactNative, it's basically a process RPC to a bunch of widgets
>Yet I can't help but wonder why so many people are focused on solving UI issues with very narrow solutions like Electron, ReactNative, ProtonNative and so forth
I've used React Native in the past and I'm working on a Flutter app now. The problem with RN is that every platform has its own unique widgets. It's neat that you have one codebase, but you still need to build a separate UI (at least for certain pages) for Android and iOS. It just doesn't look right otherwise.
Flutter gets away with this because it owns the drawing layer as well as the widget layer. I know that something drawn in Flutter is going to look exactly the same no matter where I run it. This means that widgets fail gracefully by default - in RN, things just straight up break or look weird. The worst that can happen in Flutter is that the user has to deal with an iOS picker on Android or vice versa.
Electron is more akin to Flutter than RN in this way. It controls the drawing/rendering because of Chromium. Slack on Mac looks exactly like Slack on Windows. That's more enticing than needing to build new UIs for every platform you want to support.
The only way to solve this is to basically invent another cross platform drawing layer. But why bother? HTML/CSS already exists. There's effort and tooling and docs and community and everything else you'd need for a successful framework. It's not worth the effort.
I think the best solution will be just embedding Electron at the OS layer, so apps don't have to bring along their own Chromium runtime. This way it runs closer to the metal, which should help alleviate RAM and storage concerns (these seem to be the only major concerns most people have with it).
That's assuming we want that though. TBH I'm tired of web apps. I pay for a bunch of OSX native applications because it just feels better. I want to minimize friction for creating truly native apps. Not just for performance, but for visual consistency, OS features, etc.
I disagree that RN just breaks or looks weird. It does, yes, if you're trying to ignore platform widgets and make your own unicorn. I however am mainly speaking as a user. I want applications that feel like they are on my platform of choice, not some UI designers HTML page thrown into every OS.
You're right in cases where app devs are trying to make cross platform apps without actually making what I view as an application. They're just wanting to put their webpage onto the users computer. However I'm not wanting that. Luckily for them they already have that; It's Electron, and it works great for them. You're right we can minimize how awful Electron is, but I want native apps to feel good, feel native. I pay for apps that are more than just HTML.
Lastly, I think you sell RN's design short. Making two separate apps with RN involves a lot of code reuse. It's the same codebase, with two different binaries effectively. You can abstract a lot of logic to a unified layer, the majority duplication ends up being layout and widget choices. You're in the same language the entire time, using all your helper libraries and in general it feels identical (speaking from my experience, at least). Compare this to writing an Android app and a iOS app using their native languages. RN's developer overhead is miniscule by comparison. This gives users a native feel with a minimal amount of developer work.
I'm saying we need a RN-like solution to minimize effort for developers who desire to give users a native experience. I also greedily hope that in a world where this exists, HTML on my desktop won't be used as much.
Isn't this pretty unfriendly to users? As an iOS user, I occasionally encounter apps written with Material guidelines in mind, and it's a bit jarring because they don't fit the guidelines of the device I'm using.
These are all great solutions for developers, but for consumers, it all kind of sucks to varying degrees.
Personally I care a lot more about what app I'm using than what OS it's running on; I'd far rather have Slack look the same on my phone as it does on both my computers than have Slack on one computer look like apps on that computer but different from Slack on the other computer. Sometimes we forget that the OS exists to facilitate the apps, not the other way around.
For OS where the base operating system didn't offer much functionality to apps beyond the basic API for building controls and so on, this might be true.
For Apple's systems, especially macOS and iOS/iPadOS, this isn't quite true. On iOS, apps need to be built according to system conventions and standards in order to be able to take advantage of a lot of services that the OS provides (such as accessibility, automation, i10n).
When a macOS or iOS ignores system conventions, the result can range from completely unnoticeable, a slight inconvenience, or the app being next to unusable after the OS updates due to underlying features being changed without the developer having updated their (needless) custom code to account for it.
I notice this with the Sensibo app which follows Material design guidelines. It took me a long time to figure out how to edit a particular bit of information because the icons that the app used were not what I was expecting. On iOS, an editable table view should be accompanied by a button at the top right that says "Edit"; Sensibo instead provided a pencil icon. After I finished editing, I wasn't sure what to do — on iOS, I expect to see a "Done" or "OK" button where the Edit button was; instead, Sensibo required me to click on the pencil again even though it was greyed out and looked inactive.
When an app doesn't conform to the guidelines and I have a choice about whether or not to use that app, I'll generally prefer to find something else where I'm not expected to memorise how to use it.
Sometimes we forget that apps exist to facilitate getting tasks done, not forcing us to remember their deliberately-included inconsistencies compared to every other app on the system (including third party ones).
I like the idea of a protocol and that is pretty much what Boden attempts to achieve in the end. Having said that, the more I work on this project the more I come to believe that, at a certain point (level of detail), attempts at the unification of real native UX on different platforms become virtually impossible. To achieve real native cross-platform UX, you need to embrace and take care of the different aspects, behaviors, and quirks of each platform. Boden attempts to make that as easy as possible (and without forcing you to write JS).
I 100% agree. My recent comment[0] mentions the same thing.
I'll look into Boden, sounds promising! With that said, I don't see any mention of desktop builds. Is that on Boden's roadmap? Would love to try it with Rust some time.
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.
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.
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.
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...
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.
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.
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
I mean, how much data can a user for a personal finance app store in a year?
(to be clear I consider this a very generous estimate of how big this could possibly get)
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.
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.
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.
You're not making it any better...
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.
$ 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)Developers shouldn't be assuming that their users will have machines even close to theirs spec-wise.
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.
For example, Apple shipped their first TouchID laptop in 2016, and Electron's support for that landed in v6.0.0 beta 1 just last month.
https://electronjs.org/releases/beta?page=2#6.0.0-beta.1
I'd looked at switching off 1password to BitWarden and that's a pretty major feature to be missing for three years.
Surprisingly, for as much as everyone craps on the touchbar, that got supported by Electron a lot faster than TouchID did. I guess because not all apps need authentication and they can rely on passwords instead, while it's really obvious when an app doesn't have touchbar support.
If you want to complain about applications' engineering, you should complain not about claimed memory but about things that are directly affecting resource utilization or user experience like power draw or excessive CPU utilization due to poor programming. Claimed memory must be combined with a profile to show that cold reads are common enough for the claimed memory figure to be correlated with a performance hit. But of course, this often isn't readily available without profiling for all but the most extreme cases, and so engineering types fixate on easily visible measures like claimed memory that likely have no actual resource utilization impact in most cases.
I tried that once. But I'm sick of having to fight that my usecase is valid, that my laptop isn't too old, and that it isn't broken/misconfigured in some other way. It's 4 years old, and I can't run 2 electron applications and firefox at the same time without swapping so hard I can't get anything done. Fuck me for asking so much from a computer, right?
One example that's driving me mad is shotwell (photo managing software). For some reason whenever you start it, it is crawling your entire collection of photos again. There are countless rejected tickets from people asking to add an option to disable it. I personally manage my photos on an older laptop with a spinning 2tb drive, for when I travel... So I'm somewhere without a power outlet in reach, battery sitting at 12%, and would like to quickly show some photos to a friend, but opening up shotwell will make sure that remaining battery will be drained in an instant. But the neckbeards developing that software sitting in their basements with 4 SSDs running in raid 0 just fail to understand what my problem is. Sadly I haven't found a good replacement so far, feature wise.
Edit: Also forgetting your password sucks ;-)
But who gets to make that call?
For every person out there who complaints that using voice chat in Discord on a MacBook Pro on battery causes the chassis to heat up, fans to kick into turbo boost, and the battery to dwindle — but only when using the .app, not when using the website through Firefox, there's another person who says "oh, but my computer doesn't do that".
So then everybody who has a similar complaint as the first person is branded a liar and whiner.
> I want something more lightweight eventually
Check out https://github.com/revery-ui/revery
Unfortunately since I can't rewrite my project entirely, I'm going to need something that reduces bloat by using a local webview instead, so it's still web-based.
It's not even clear if you're being disparaging or whether you intended to follow this up with "and that's why I'm glad people reuse that stack instead of adding yet more bloat to my already struggling machine in the form of a home-rolled sub-par UI rendering stacks".
No.
I am saying that your original statement is of no use because it has no information: it is an anecdote about "some browser" running on "some machine" being in "in some way", none of quantified or even further described, and so your claim can't be used to draw any conclusions about really anything at all.
What did you even intend to imply? Did you say it because you wanted to thumbs-up the idea of reusing already installed browsers (because it can certainly be read that way) or did you want to thumbs-down the idea of using the already installed browser? (because it can certainly ALSO be read that way).
You want details?
19 tabs. ublock origin, tab search.
The browser process alone (no tabs included) is sitting at about 615 megabytes of RSS. The GPU process is using another 325 megabytes. Ublock origin is using 115 megabytes on top of that. The tabs are varying between 20 megabytes (for the runit documentation, http://smarden.org/runit/), 100 megabytes (browsing a private github repository), 200 megabytes (for a Jupyter notebook with about 10 paragraphs and 3 images shown), to 1.2 gigabytes of memory (Slack tab).
The next fattest program I have currently running is Wireshark. It's at around 200 megabytes of RSS while dealing with a capture containing about half a million packets in the current list view. MPV is surprisingly large, sitting at 110 megabytes -- guessing some of that is buffering the video, but it's still a bit surprising. Sylpheed is also significant, at well over 150 megabytes. And all of the gvim 20-odd gvim and terminal emulator processes add up, each one at close to 20 megabytes of RSS. Evince is also significant, although I've only got 7 or 8 of them running. Each is using about 60 megabytes of RSS.
Still, all non-browsercombined running on my machine come out to about 20% of the RSS size of Chrome, in spite of Chrome processes being 25% of the total number of running processes.
But I suppose you're technically right: Chrome isn't the heaviest thing on my machine -- Those tend to be spark jobs that I spin up. Those are capped to 30 gigabytes. But I don't do much spark these days, so...
The "hello world" which opens a webpage in a window is just a single line of C code and produces a 26 kilobytes executable on macOS.
Such a wasteful world.
garbage in, garbage out
"dd" is 37KB.
BTW comparing an GUI app with a CLI-only program sounds unfair.
But it's also heavily recommended within the Raspberry Pi community, and used by Balena's customers for starter IoT applications. We can assume most of the users of this application are beginners.
So, do you think these beginners would care about the size of this "app" that they'll probably delete as soon as it finishes? Do you think they'd care about 200MB of RAM when they're almost certainly running it on any modern PC instead of some ancient EeePC from hell? As a beginner, would you feel more comfortable in front of Etcher or dd?
The crux of your argument basically boils down to "a GUI takes up more RAM than a CLI." Which is obviously true, but it doesn't invalidate the need for more GUIs in the world. Could Etcher have been built with a native GUI? Sure, but it's free software, there are no expectations. If you wanted to, you could clone the repo and build it natively yourself.
But why would you? Etcher already exists, and it would save you from hundreds of hours of debugging and learning new frameworks. Knowing HTML/CSS/JS, you could build Electron Etcher in a fraction of the time it would take you to build Qt4 Etcher, and the compromises are acceptable given the target audience.
And now you understand why the Etcher devs chose Electron.
Well, looks like enough people care (or at least noticed) https://imgur.com/LV6AT7d
https://github.com/balena-io/etcher/issues/2365#issuecomment...
No one is claiming that the choice to use electron is without merit or that it is a mysterious choice. It's just heavily disappointing that we've gotten to the point where 300mb and 4 processes is acceptable for the cruft developed with it.
If you want disappointing, how about the fact that we're still finding buffer overflow vulnerabilities? IMO we shouldn't even begin to talk about software performance while we have such difficulty getting software to behave correctly at all.
A 64kb Z80 computer is perfectly suitable for a few rows to balance. After all, they went to the moon with 16kb of RAM.
In addition, once the actual bottleneck has been identified, doesn't this open the door to fix things on the WebKit/Blink engine side of things? Before, when Electron was managed by GitHub, one could say this would be unreasonably difficult, but now that GitHub is owned by Microsoft, isn't tweaking Blink to be more suitable for deployment environments outside of Chrome exactly the type of thing they would have a vested interest in doing, and the resources to actually pull off? After all, with VS Code, they are one of the highest-profile Electron users, and using Blink in Edge presumably involves working with the Blink code to some degree anyway.
It's always struck me that a lot of Electron apps likely never use a single line of WebGL, while a lot of WebGL apps likely only use DOM APIs to pretend the DOM doesn't exist by plastering everything in a huge <canvas> element, and both likely don't want their binaries to include the Chrome devtools, but Electron includes all of these things anyway. I'm not sure how much space or resources it would actually save, but is Chromium/Blink refactoring their code and build process to facilitate Electron building different Electron "profiles" that include different sets of features even remotely a possibility?
Summarizing, electron apps are just feels like foreigners.
My problem with electron apps is that they use way more memory and cpu than they should be - the architecture fix for that would be to not be a full browser.
The problem I have is they lack basic app behaviors from the platform. My experience is mostly for the Mac, but my experience using vscode on Linux has been similar.
But here we go, for a Mac:
* cmd-e/f/g are so wide, not just app wide. Vscode goes even further and seems to achieve per-view behavior.
* document editors and viewers are expected to have an icon for the file being edited, either in the window or in the tab. That is a draggable link to the file, and a drop down on right click for the directory hierarchy.
* drag and drop of files into and out of the windows don’t work
These are basic behaviors that even the simplest apps manage to get right on OS X, yet no electron apps seem capable of meeting this low bar.
Is there any other platform that provides:
- Support for the 3 major desktop platforms from one code-base;
- A decent choice of high-level programming languages (there are excellent compile-to-JS options now);
- Reasonable tooling and community support;
- MIT (or similar) license
It's LGPL, which is fine for most cases. But you could always buy a commercial license.
- Support for the 3 major desktop platforms from one code-base;
- A decent choice of high-level programming languages...
C/C++, Go, Rust, C# and other .NETs, Delphi, Python as host languages.
- Reasonable tooling and community support
Whatever host language provides.
- License: Sciter is free to use in binary form.
Contained in single dll/so/dylib without external dependencies. Size of DLL is 5-10 mb.
Can be statically linked into host (C/C++) application to create monolithic executable.
Honestly, if I had to develop a Desktop app today and wanted it to be cross-platform, I’d probably use Electron. No need for hacky workarounds like in a web app to make it run on every major browser.
It's the worst possible combination. All of the downsides of web apps (poor performance, memory use, poor integration, etc.) and native apps (security problems, hard to update, etc.), without the advantages of either one.
Why would I want to download your specially packaged browser, without adblock or uMatrix or any of that, just to basically view a website anyway?
Then the user can run your chat/music/text editor in the background, have it appear in the taskbar, and start boot, at the cost of requiring a few gigabytes of RAM and 25% CPU utilization while idling.
Personally I'd rather have Progressive Web Apps but for some reason, those are still in an awkward stage.
And none of those "benefits" have any advantage over running the web app in its own window.
It's a hack to use cheap web developers to check off the "standalone app" checkbox.
Is that supposed to be an advantage? ;)
Yes you do. Because some people understand UI design and know how to program in javascript/html/css and have a need to make a desktop app.
For example, a small budget indie startup has enough to make ONE version of their app to get funding. They can use JS with the same budget and launch on Web, PC, Mac, Linux, iOS and Android instead of just making a single Windows native app.
There is 100% a place for electron. You can argue that after funding they should convert to native, sure. But if you're reading HN you are definitely smart enough to know why a lot of us use electron :)
tldr; Smart use of electron is NOT for the end user. It's for the developer.
I will put this in category of 'The secret of good user tracking on web', 'the secret of doing quality journalism on ads supported model' or 'the secret of nuanced political debate on Twitter' etc.
This node IPC debugging technique is pretty nice!
For Electron haters, here are the alternatives: OpenJFX (some people hate Java), Qt5 (it can be pricey in some situations), wxWidgets (not popular enough?).
However, I have a lot of hope for Flutter in desktop. I hope the developers of Flutter framework can pull off the challenge.
In my case, for opensource projects, I definitely use Qt5 (using PySide2). But for proprietary projects, I have to admit that most likely I will choose Electron.
Two solutions I have found during my development:
1) Keep your components light. Most of what I used from Material can be done completely with raw HTML and CSS in a simpler fashion without much going on in terms of state, so I created my own components that serve my purposes. A lot of libraries and frameworks are heavy because they are used on webpages viewed by multiple different browsers and require complex logic to work across different environments. Electron sandboxes your code in Chromium + node, you code only for 1 browser engine, so I hope more devs take advantage of that fact.
2) Load what you know you need in the beginning, and keep your cache to a minimum. Most Electron apps do not have view transitions, they are built as SPAs. One of the downsides of this is that you need to be mindful of your cache since it is not cleared when you display a new component. Clearing the things that don't matter to the view or data has been essential in keeping my memory footprint small.
With a large app that does many things and loads many views, I'm able to keep the RAM usage to under 200, most times around 150, which, while larger than something like Excel running idle, is a small price to pay to have intuitive design features and access to a large and constantly growing library of reusable components and packages.
The old-style serialized drawing commands model is only responsive when you have a very simple UI that doesn't do much drawing.
But I love the addition of defaulting to a node server for lower memory usage.
The Atom editor (the first Electron app) has slowly been rewriting a lot of their modules in C++ for speed and lower memory usage, binding to them through NodeJs. Kind of ironic since GitHub created Electron to build desktop apps using web technologies.
Somehow that card didn't get moved to done, sorry! Let me know if it doesn't work.
Specifically - I should not have to think of having to “ctrl-R” for a desktop application.
Good electron apps do exist, but they feel like a vast minority. Most just feel like a bloated version of their web application.
I second this, but there are a few reasons why they can't. For example Blink does not respect MacOS highlight color setting so any electron app won't either.
I should not be able to select text in parts of interface (e.g.: text inside a button), but it is pretty common that a cmd+a selects everything including interface.
Buttons should be in the correct order and have correct highlights depending on the platform.
The whole point of electron is to avoid those native things.
You are making your life as a developer easier in exchange massively increasing the resource requirements and battery usage on end-user machines.
It's just bad practice and Electron encourages it.
I feel like if we ever want to be taken seriously as a profession the way structural or mechanical engineers are for example, then efficiency and reliability need to be primary considerations, otherwise we are basically making toys.
The main reason to use Electron is that I can have happy macOS, Windows, and Linux users. Apps that focus on a single platform are exclusionary.
And if you want to make an efficient desktop app, look at telegram source code.
- Hire a C++ programmer
- Learn C++
- Adapt knowledge in your current language of choice to C++/Python
- Find a designer who can use Qt
- Adapt common tools normally found in npm to C++
- Rewrite your application logic to run in C++
Should be simple for any dev to do considering the pay off is lower RAM and "native" look and feel
I like to think the reusability and speed of development with electron is just terrific and is a trade-off that is worth it in the end.
Plus, when you do fill your RAM, you have to start contending with swapping, which slows everything down significantly.
My point being is, we are not stuck with 2 gbs of ram anymore and like games, apps will scale to use more resources for ease of development or better features.
Of course they are not going to swap unless they have to, but they will swap in default configuration.
The alternative is for things to start crashing when you run out of memory rather than swapping out.
But not Android, iOS or iPadOS. (And for good reason - these OS's run on devices that use bottom-of-the-barrel flash storage and can't sustain the wear-and-tear that comes with using swap.) That's not "literally every major OS"!
Doesn't seem a lot different from swapping the memory to disc until its accessed again.
Not to mention, it's kinda irrelevant to a discussion of electron applications.
Bubkiss. Using ram is an inherent negative that is justified by saving cpu time or disk access.
All things being equal if you could do the same job with a fraction of the resources the user would be better of because someone else's bloated app can use that ram or it can be used to cache files. It certainly isn't "wasted"
Now using ram to cache files is unequivocally good because as the file exists on disk we can at any time evict it from memory and read it again later.
"Laptop and battery-driven devices is a whole other matter though." Wherein a whole other matter is the majority of computers.
"If you have 50 of these apps running doing work while playing a game while having a pc from 10 years ago, then I can actually see a problem"
Complete strawman. There are probably more people that are poor or cheap running slow devices than fast, This is by no means limited to a tiny number of very old devices. Likd 80% of computers are constrained in terms of battery or ram.
"electron is just terrific and is a trade-off that is worth it in the end"
What you are actually saying is that you value one developers time over a million users time. The challenge is that it doesn't scale very well. If the user runs 10 apps that use a gb per app a typical 8gb ram machine will be swapping when switching apps and a 4gb which still exists will have stopped working.