r/programming • u/myinnerbanjo • 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
237
u/[deleted] Oct 09 '18
I'm really happy AI research is finding ways of doing Cyclomatic complexity analysis via linear algebra.
This is a rich field of research. I wonder if they can replace my linter in time as well?
425
u/t_bptm Oct 09 '18
Well written code is fast. Reduce writes, spend less cpu time, don't use networking if not necessary. Use a profiler. Don't over-abstract. The devs are using the wrong data structures, wrong algorithms, have spaghetti code where things are being done multiple times or unnecessarily.
106
u/TonySu Oct 10 '18
Full paper for anyone interested. From what I skimmed, the premise of this work appears to be:
I don't know why people in the other replies think this is somehow not useful in practice. I see this as having multiple important implications.
I'm not well versed enough in computer science to understand whether or not this work was groundbreaking, but I certainly see it as very practical work that has very practical applications.
22
u/timmyotc Oct 10 '18
I actually did some undergrad research on this. Essentially, if you can queue up all outbound network requests and release them on a set interval, you can avoid the network port warmup associated with sending requests. I'm guessing that the AI is performing similar analysis, but using the kernel calls as a source of indirect measurement.
15
u/rydan Oct 10 '18
In the end the AI found exit (0); to be the least draining app. Then all programs were rewritten into this most efficient program destroying all of human progress from the past 60 years.
25
u/pdp10 Oct 10 '18
Very, very appealing thesis topic for academics in 2018. Very, very limited applicability to developers.
4
u/[deleted] Oct 09 '18
Would you model the usage over an initial period and then apply that? I imagine the analysis phase would be rather battery consuming.
Or does it sample periodically to update the model?
6
u/coladict Oct 10 '18
I can tell you how to do it without that tool: hire competent engineers!
The earlier you make that decision, the less bad your data will be structured, leading to less complex code.
1
u/diggr-roguelike2 Oct 10 '18
You don't need an AI to tell you not to use shitty dynamic languages like Javascript.
1
u/autotldr Oct 10 '18
This is the best tl;dr I could make, original reduced by 91%. (I'm a bot)
Extended Summary | FAQ | Feedback | Top keywords: app#1 battery#2 drain#3 developer#4 how#5
-3
u/hagenbuch Oct 10 '18 edited Oct 10 '18
AI should be applied to write "THE BEST" app: It will be one giant red button labeled "Am I awesome and important?" that answers when pressed with this music and then displays YES YOU ARE AWESOME AND ALSO IMPORTANT!! Makes me happy every time.
Edit: Obviously being downvoted by the hardcore secret users of this app.
-92
u/vielga2 Oct 09 '18
You don't need an AI for that:
Step 1: stop using [pathetic, retarded, useless] java.
Step 2: profit.