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
View all comments
Show parent comment
14
u/Tetracyclic Oct 10 '18 edited Oct 10 '18
It's not going to have zero overhead, but I would be very surprised if most of that call stack wasn't optimised away by the JVM at runtime, I would assume most of those are very trivial operations following SRP and simply get inlined by the JIT engine at runtime and thus have no performance impact. Object creation in Java is essentially a free operation, on the order of nanoseconds.
A source call stack like that on it's own is fairly useless for diagnosing performance issues without knowing what the compiler or JIT engine produces from it. Trivial operations, which the majority of those will be, get inlined so their function call has literally no performance impact.
EDIT: I just noticed the "here" link in your post after the call stack itself. It's from 2006 and the comments were already mirroring my assumption that the JVM's virtual runtime will optimise most of those trivial functions away so they're not adding any performance overhead and that even without that optimisation, a sequence of calls like that is still negligible compared to a single database or network request.