静态指标不足:用执行时间预测Java方法能耗

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

精选理由

论文有硬数据:只看代码静态指标预测能耗基本无效,加上执行时间后R²从0升到0.46,做绿色软件开发需要知道这个差异。

AI 摘要

该论文研究了Java方法级别的能耗预测,分析了2,786个Java方法的33个静态特征与执行时间和能耗数据。训练并比较了11个回归模型,发现静态代码指标预测性能差,平均R²接近0。加入执行时间后R²提升至0.46,执行时间、内部方法调用和圈复杂度成为最强预测因子。

原文 · arXiv cs.LG

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

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.