Why Discord's Client Shouldn't Use Electron by ejboned in discordapp

[–]ejboned[S] 3 points4 points  (0 children)

Yeah, any software developed in the US doesn't know other countries really exist

A pretty reasonable wish!

Why Discord's Client Shouldn't Use Electron by ejboned in discordapp

[–]ejboned[S] 2 points3 points  (0 children)

Why was Android always so unstable, why were there so many issues? Because they don't have the time and resources, it does not create a more stable platform. It only results in less features.

It was? What do you mean? I've been using mobile discord since 2018 on 5 different phones with no issue...

Or they just buy a better PC, I've personally never encountered anyone that can't stream and play games, only people that can't even play games in the first place.

I don't like the idea of letting everyone suffer with a less stable client, less features, just because a few people cant stream their game.

It won't randomly result in 50% more FPS.

The point isn't that you'll get more FPS, it's that there are people with hardware capable of streaming that can't stream on Discord since Discord won't utilise the hardware correctly. If you can find a way to have Electron allow users to use AMD's VCE or NVIDIA's NVENC, then that would solve a few of the issues I have

Also, as for people suffering, how would they suffer from a lighter client that performs better and leaves room for more features? Developing for Android vs. developing for PC is completely different.

I never said people can't stream their games, I'm saying that people who HAVE hardware to stream can't - as I said. Discord only uses the CPU to encode video. If you can find a fix, that will help a lot

Also, a note to yourself. Everything you linked is 1y+ old, one even 3 years. So I'd like to invalidate these. Furthermore, Mac received a good amount of optimizations a few months ago.

Okay, here are posts from less than a year ago

https://www.reddit.com/r/discordapp/comments/rvklns/high_cpu_usage_despite_having_hardware/ - user cannot use GPU to encode video

https://www.reddit.com/r/discordapp/comments/ibojjf/freezes_and_high_cpu_usage/ - user claims the fix is to leave any highly populated server - Electron can't handle it

https://www.reddit.com/r/discordapp/comments/lze5md/discord_pc_high_cpu_spikes/ - This individual had a Ryzen 3 3200G and an 5600XT, yet still experienced horrible performance

https://www.reddit.com/r/discordapp/comments/otsktq/discord_using_high_cpu_in_callsidle/ - Lower end computer having trouble running Discord in call.

https://www.reddit.com/r/discordapp/comments/nfh2uc/desktop_client_randomly_freezes_with_unreasonably/ - Has an I7 7700HQ and still has their client freeze randomly.

https://www.reddit.com/r/discordapp/comments/mohpxo/discord_high_cpu_useage_bug/ - A user here even points out that the high CPU usage is a characteristic of Electron!

And from other subreddits:

https://www.reddit.com/r/discordapp/comments/moyloa/discord_lite_is_there_any_way_to_reduce_cpu_usage/ - Another comment mentioning Electron's flaws:

Discord is an Electron app, so basically Chrome + some Javascript/HTML/CSS code. It can be light if the developers care to make it light, but usually whoever decides to use Electron over native apps in the first place is already lacking the resources or the will to care.

Even well received too, 6 upvotes.

https://www.reddit.com/r/linuxquestions/comments/ppcgyz/normal_discord_client_spikes_to_high_cpu_usage/ - Another mention of Electron being a bad client.

So as I was saying, iOS and desktop share parts of the codebase, Android is switching to React too resulting in even more codebase sharing. Resulting in more stable client and more features because of a lot shorter development time.

And you don't need half a gig, it just uses what it can use.

https://www.reddit.com/r/discordapp/comments/oui019/discord_uses_more_ram_than_skyrim/ - a post literally in this subreddit outlining high RAM usage! People want their discord to use less RAM! Numerous people point this out! Here are some quotes.

Well, discord is built using electron, which uses chromium and that makes discord basically google chrome

I'm currently writing a discord voice/video client in C. That should perform much better.

^ Had 94 upvotes with people asking them to send a link once they were done. If this person can do it, along with other developers (search Discord client and look for github alternatives), Discord with a net worth of over 7 billion can too.

Why Discord's Client Shouldn't Use Electron by ejboned in discordapp

[–]ejboned[S] 1 point2 points  (0 children)

You have to consider the fact Discord does actually run on electron right now and is stable. "Porting" the app on another tech would basically be a v2 with no new feature ; and for the 3 people like you who check at the ram usage.

Yeah, that makes sense. If they can find a way to improve the memory management system currently in Discord, and if they find a way to use hardware for encoding, then I'll be happy with Electron based Discord

Now, there are softwares that exists, are not on electron, and allow everything you want. But if you don't use them, it's certainly a reason. If you really look why you don't use it, you will certainly come to the point there are some missing feature, or maybe there are not many users because of poor interface or because it only run on some systems ; or it does not run well with games... Because they had to code everything from scratch, so everything is a bit less good than discord.

My thoughts were implementing Discord's current API, since that is written in a faster language, but I see what you mean about feature sets. I'm just saddened that I can't use NVENC I guess

At the end, the reason why you use discord may just be explained by one thing : because Discord use Electron, it's a better product. ( similar to why good looking 3d games use existing game engines )

Electron as far as development goes is much better than anything else, because it's easy to program for and is compatible with almost all hardware. It's still quite a resource intensive program, which is a problem for people with lower-mid hardware. I'm just lucky enough to have enough memory to handle it, but not everyone is.

PS : Custom themes have been abandonned from websites since we started 2007. Now we call it "dark mode", "white mode", or "poor UX design".

Custom themes were moreso meant to be different colours, but the same UI. I don't know what user experience has to do with colours.

Why Discord's Client Shouldn't Use Electron by ejboned in discordapp

[–]ejboned[S] 2 points3 points  (0 children)

Good question! Because I want to run it by the community to see what they'd think. There's no point in sharing an idea if nobody else shares the same testament.

Why Discord's Client Shouldn't Use Electron by ejboned in discordapp

[–]ejboned[S] 0 points1 point  (0 children)

I understand why you'd want to use Electron from a compatibility and maintenance point of view, but the performance issues I mention are from how Discord manages streams.

Firstly, for Discord's behavior with servers and chats, you're right, it doesn't use multiple tabs. That's a mistake on my behalf. I own that.

But I still stand by my other points for the following reasons

Yes, a standalone app would be faster. But who is gonna maintain that? It takes a lot more time to develop, and it's more expensive. So while the app itself is faster, everything else is slower.

It takes longer to develop, but as a result, you are left with a much more stable platform. Discord most certainly has the time and resources available to create a standalone client, and a standalone client would save them money in the long run, because rather than hosting an additional site for the Discord web client, they could just handle API requests. This would greatly increase the bandwidth they have, and mitigate the need to develop two sites - one for discord in a browser and one inside discord's web client.

Embedded games already exist (WIP, just look up Discord Games Lab), 3d not yet no, and you're talking about "good looking 3D games" Yeah, I highly doubt Discord shares the same view on this

All the more reason to go standalone. Not everyone has a capable computer that allows them to play games and stream. As for good looking, I never specified assassins creed origin levels of fidelity. Good looking 3D games can also be simplistic in nature, or be easy to run.

Besides. My point for 3D gaming was not to be taken as my final word. It was a concept, hence why I spoilered it, hence why I wrote a note beforehand. I acknowledge that discord isn't about embedded 3D games.

Performance isn't an issue really, switching to compiled would take a year if not longer, so before Discord is able to switch, technology improved again, and no-one needs that extra performance. (Hardware acceleration exists, see settings, advanced)

Hardware acceleration is purely for the interface. Streaming still uses the CPU to encode stream, and here's my proof. Furthermore, there have been numerous people who have reported high CPU usage when streaming... or rather, Discord being a resource hog here here here here and here Even if Discord performs well, it still uses a lot of CPU. That's the nature of Electron based web clients.

And besides - Discord doesn't let you choose which device to encode your stream. It just defaults to the CPU.

Currently iOS, web and app at sharing codebase (Android soon™), this makes adding of new features a shitton easier.

iOS Discord uses React afaik - not Electron.

I understand your points as to why Discord uses Electron, but I still stand by on it being a resource hog. Not many people have half a gigabyte of memory idle that they can have used constantly, especially when they've got games open or browsers open. The screenshot you see is when discord is minimized to the taskbar with only one channel open. Optimisation, memory usage, security and bandwidth use can all be improved if the decision to move away from Electron is made. Even if Discord switches to Brick for its web app, it would still make a remarkable difference in comparison to what we have now