arXiv:2607.06124cs.SEcs.AI2026-07中稿 · publication at the…

用执行时间提升代码能量消耗预测准确率

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

论文配图:Static Metrics Are Insufficient: Predicting Java Method Energy Usage with Execution Time
图 1 · 摘自论文原文
  • 结合代码静态指标与执行时间预测能耗
  • 加入执行时间后预测准确率提升至R2=0.46
  • 适合关注软件能效的开发与优化人员

软件系统日益增长的能源需求引发环境与成本担忧。在开发早期评估能耗可显著降低整体能耗,使开发者能在设计阶段做出优化决策。然而,缺乏重复性能分析和直接测量时,能耗评估困难,限制了早期干预。本研究探讨了Java方法级能耗预测的边界,检验静态源码指标与方法执行时间能否联合预测能耗。我们对2,786个Java方法进行采样,提取33个静态特征,同时测量执行时间和能耗,并训练比较11种回归模型。结果表明,仅使用静态指标时预测性能极差,平均R²接近零;加入执行时间作为轻量动态输入后,预测准确率显著提升,最高达R²=0.46。执行时间、内部调用次数与圈复杂度始终是最重要的预测因子。

原文摘要 · Abstract (English)

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.

能耗预测静态分析代码优化

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。