Insufficient static metrics: predict Java energy with runtime

Static metrics are insufficient to predict energy in Java. Runtime raises accuracy to R²=0.46. Learn to optimize your code.

miércoles, 8 de julio de 2026 • 2 min read • Q2BSTUDIO Team

Combining runtime and metrics improves prediction

In contemporary software development, energy efficiency has shifted from a secondary factor to a strategic criterion. The unstoppable increase in computational demand, driven by distributed systems, artificial intelligence, and massive data processing, shifts the focus toward responsible consumption that impacts both operational costs and the environmental footprint. Traditionally, energy expenditure assessment was carried out in advanced phases of the lifecycle, through execution profiles and direct measurements on real hardware. However, this approach hinders early decision-making, when it is still possible to redesign architectures or refactor code without major cost overruns.

Recent research has explored the predictive capacity of purely static metrics extracted from source code, such as cyclomatic complexity or the number of internal calls, to estimate the consumption of Java methods. The results indicate that these variables, on their own, offer very limited predictive power, with coefficients of determination close to zero. The reason is evident: actual consumption largely depends on dynamic behavior, especially runtime. When a lightweight, dynamic metric such as method runtime is incorporated, model accuracy improves significantly, reaching R² values around 0.46. This suggests that combining static analysis with minimal dynamic data can be a viable strategy for anticipating energy expenditure without resorting to costly continuous profiling.

This line of work has direct implications for companies developing professional software. At Q2BSTUDIO, we understand that energy optimization is not an aesthetic addition, but a requirement for competitiveness and sustainability. Therefore, by offering custom applications, our teams integrate practices from the design phase that allow anticipating inefficiencies. Custom software creation allows adapting each layer of the system to real consumption needs, avoiding over-engineering and wasted resources. Furthermore, incorporating artificial intelligence into analysis processes —such as AI agents that monitor execution patterns— facilitates early identification of energy bottlenecks. Our business intelligence services with Power BI allow visualizing these metrics in dashboards, transforming technical data into strategic decisions.

Energy prediction at the method level also benefits from an adequate cloud infrastructure. The AWS and Azure cloud services we manage provide elastic environments where it is possible to run parameterized tests without interference, collecting runtime metrics in a controlled manner. Combined with robust cybersecurity —another of our areas of specialization— we ensure that sensitive performance data is not exposed. The AI for companies we develop not only optimizes predictive models but also automates the selection of the most relevant variables, such as cyclomatic complexity or internal calls, for each application context.

The central message of this research is clear: relying solely on static metrics to predict energy is insufficient; the dynamics of runtime are indispensable. For organizations seeking artificial intelligence applied to efficiency, this dual approach represents a real opportunity to reduce costs and emissions without sacrificing performance. At Q2BSTUDIO, we integrate these principles into every project, from initial analysis to deployment, offering solutions that go beyond code and embrace sustainability as a pillar of innovation.

A BREAK?

Play for a moment before you go

OUR SERVICES

How we can help you

Do you have a project in mind?

Tell us your vision and we'll turn it into a software solution. Whatever the scope, we make your idea real.