Static Metrics Are Insufficient: Predicting Java Method Energy Usage with Execution Time

Muhammad Imran, Vincenzo Stoico, Ivano Malavolta
7/7/2026
cs.SEcs.AIcs.LG

No confident code implementation found for this paper.

Abstract

The increasing energy demand of software systems is raising concerns about their environmental impact and associated costs. Reasoning on energy usage early in the development flow has the potential to significantly reduce the overall energy usage of a software system, as it allows developers to make informed design and refactoring decisions before inefficiencies propagate. However, assessing energy usage without repeated profiling and direct measurement is difficult, which limits early reasoning in practice. This study investigates the limits of method-level energy prediction in Java, examining whether static source code metrics complemented with method-level execution time can estimate the energy consumption of Java methods. We profile 2,786 Java methods to extract 33 static features and measure execution time and energy, then train and compare eleven regression models. Our findings show that static source code metrics alone yield poor predictive performance, with average R2 values close to zero. Incorporating execution time as a lightweight dynamic input significantly improves accuracy, raising R2 to as high as 0.46. Execution time, internal method calls, and cyclomatic complexity consistently emerge as the strongest predictors of energy consumption.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. Any repos shown below are weak matches — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{imran2026static,
  title  = {Static Metrics Are Insufficient: Predicting Java Method Energy Usage with Execution Time},
  author = {Muhammad Imran and Vincenzo Stoico and Ivano Malavolta},
  year   = {2026},
  eprint = {2607.06124},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2607.06124v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2607.06124.svg)](https://codeofpaper.com/paper/2607.06124)

Discussion