一句话:实证表明 SpotBugs 更高努力等级通常更耗能,但收益递减,建议显式暴露精度与能耗的权衡。
静态分析工具常用于 CI 流水线,在不执行程序的前提下检测潜在缺陷,并提供配置选项控制分析深度。SpotBugs 通过努力等级(Min、Less、More、Max)实现该控制,等级越高分析越深入、计算越密集。本文实证研究这些努力等级如何影响能耗与分析结果。结果显示,更高努力等级总体上消耗更多能耗,符合直觉;但能耗增长并不均匀:更深静态分析带来额外能耗,而更高等级的边际收益在某些情况下可能有限。作者据此建议,静态分析工具设计者应提高能耗透明度,并提供显式暴露分析深度与能耗代价之间权衡的配置选项。
Static analysis tools are commonly used in continuous integration (CI) pipelines to detect potential defects without executing the program. Such tools offer configuration options that control how thoroughly the code is analyzed. In SpotBugs, this is done through an effort level setting (Min, Less, More, Max), where higher levels enable deeper and more computationally intensive analysis. In this paper, we study how these effort levels affect energy consumption and analysis results. Our results show that higher effort levels generally consume more energy, which fits our intuition. However, the increase is not uniform: deeper static analysis comes with additional energy cost, but the marginal benefit of higher effort levels may be limited in some cases. This suggests that static analysis tool designers could make energy consumption more transparent and provide configuration options that explicitly expose trade-offs between analysis depth and energy cost.
@inproceedings{LindenLZB26,
title = {On the Energy Cost of Static Analysis Precision: An Empirical Study of SpotBugs Effort Levels},
author = {Sophie van der Linden and Xutong Liu and Andy Zaidman and Carolin Brandt},
booktitle = {FSE},
year = {2026},
doi = {10.1145/3803437.3805601}
}