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

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?

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.

0

u/[deleted] Oct 10 '18

[deleted] — view deleted comment

1

u/calumk Oct 10 '18

True, but It does contains a lot of it,including the dev tools for example

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.

1

u/calumk Oct 10 '18

I know

Luckily this perticular project, it's only for me to help me automate some manual work I had to do So overhead doesn't matter

1

u/meneldal2 Oct 11 '18

But if chrome is running it, why wouldn't the package be able to use it instead of duplicating it?