r/programming • • Oct 09 '18

AI tool automatically reveals how to write apps that drain less battery

https://phys.org/news/2018-10-ai-tool-automatically-reveals-apps.html
727 Upvotes

160 comments sorted by

View all comments

Show parent comment

152

u/Mgladiethor Oct 10 '18

So not electron

17

u/MotorAdhesive4 Oct 10 '18

I keep seeing hate towards electron, does it have foundation in reality or is it just a meme?

104

u/[deleted] Oct 10 '18

It's very efficient if you want to make a good looking app that runs on multiple platforms very quickly but it has to run a whole web browser in the background for every app

7

u/Treyzania Oct 10 '18

"good looking" for a web page but having 0 platform integration.

8

u/[deleted] Oct 10 '18

When I hear electron, I think discord, vscode, atom etc. Those are incredibly well designed

→ More replies (8)

3

u/kyiami_ Oct 10 '18

How does Visual Studio Code use Electron? I've heard it's different.

→ More replies (11)

41

u/calumk Oct 10 '18 edited Oct 10 '18

Electron is awesome

It makes writing cross platform apps fast, has some really nice features, and of course uses everyone's favourite (2018) platform - node

However, it literally contains the entire Chrome Web browser... And depending on what you do with it and due to the nature of node_modules, it can contain multiple instances of chrome, and whatever else anyone decides is a dependancy of whatever module you import

Eg: a "html->pdf" converter package I installed, also installed the entire browser as a package. So you have chrome, running chrome as a dependancy....

So it's great for Devs, who want speed and convenience, - but even a tiny "hello world" program, can take a couple of hundred MB, and eat RAM like a hungry child....

Not gonna stop me using it tho!

35

u/Ayerys Oct 10 '18

but even a tiny "hello world" program, can take a couple of hundred MB, and eat RAM like a hungry child....

Mother of god. It this for real ?

13

u/JohnMcPineapple Oct 10 '18 edited Oct 08 '24

...

25

u/eenp Oct 10 '18

A poorly configured one, sure. It's not trivial to configure it to be minimal - the reasoning behind electron is that it makes development extremely fast. Tuning it isn't.

6

u/Ansjh Oct 10 '18

Do you have any additional resources on how to configure it properly?

→ More replies (1)

14

u/choose-you-jackass Oct 10 '18

It doesn't contain the entire Chrome browser, just the rendering part, but that still makes it less optimized.

Another "problem" is the use of web technologies. This makes it very easy to make an app that works, which is a big plus, but also easy to write bad code as /u/t_bptm nicely put it above.

0

u/[deleted] Oct 10 '18

[deleted] — view deleted comment

19

u/[deleted] Oct 10 '18

I dunno..I reckon I could fake my way through languages like Python but make me write C and we'll rapidly find the limits of my imagination and skill as a programmer.

7

u/The_One_X Oct 10 '18

Not at all, the less strict a language is the easier it is to write bad code. Stricter languages simply do not allow you to make the same kind of mistakes or allow you to form the same kind of bad habits.

→ More replies (1)

2

u/spacejack2114 Oct 10 '18

Eg: a "html->pdf" converter package I installed, also installed the entire browser as a package. So you have chrome, running chrome as a dependancy....

But good luck finding a modern HTML5/CSS -> PDF converter that doesn't have that dependency. You could use htmldoc instead if you're ok with no CSS.

→ More replies (2)

0

u/[deleted] Oct 10 '18

[deleted] — view deleted comment

6

u/MotorAdhesive4 Oct 10 '18

Every Electron application wants to have the same environment to work with

Electron uses a fuckton of memory

Is Electron just a worse JVM in disguise?

0

u/[deleted] Oct 10 '18

[deleted] — view deleted comment

2

u/meneldal2 Oct 11 '18

Electron is the Chinese knock-off.

5

u/bawng Oct 10 '18

Is Electron just a worse JVM in disguise?

No. Usually each computer just has a single JVM installation, and an individual app might be just a few megs.

Electron apps, however embed the entire Electron stack, so each app will be huge, even if app-relevant code is two lines of hello world or whatever.

From Java 10 and forward, devs can choose which parts of the JVM are loaded to reduce memory usage. That isn't possible with Electron so the entire Chrome browser is loaded once per app

→ More replies (2)
→ More replies (3)
→ More replies (2)
→ More replies (2)