[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"doc-detail-84066-en":3,"doc-seo-84066-105":29,"detail-sidebar-cat-0-en-105":90},{"code":4,"msg":5,"data":6},0,"success",{"doc_id":7,"user_id":8,"nickname":9,"user_avatar":10,"doc_module":4,"category_id":11,"category_name":12,"doc_title":13,"doc_description":14,"doc_content":15,"file_id":16,"file_url":17,"file_type":18,"file_size":19,"view_count":4,"is_deleted":4,"is_public":20,"is_downloadable":20,"audit_status":20,"page_count":21,"language":22,"language_code":23,"site_id":24,"html_lang":23,"table_of_contents":25,"faqs":26,"seo_title":13,"seo_description":14,"update_tm":27,"read_time":28},84066,1099514067415,"Rowan","https://ap-avatar.wpscdn.com/avatar/100002539d78ffe74a7?x-image-process=image/resize,m_fixed,w_180,h_180&k=1779092875211072502",8,"Research & Report","Static Metrics Are Insufficient: Predicting Java Method Energy Usage with Execution Time","Software energy demand is increasing, raising both environmental impact and operational cost; reasoning about energy early in the development process could enable better design and refactoring before inefficiencies spread. Energy assessment is hard without repeated profiling and direct measurement, which restricts practical early guidance. This study evaluates method-level energy prediction for Java using 33 static source-code metrics plus execution time. Profiling 2,786 methods trains and compares eleven regression models; static metrics alone perform poorly (R2 near zero), while adding execution time substantially improves accuracy up to R2 = 0.46.","arXiv :2607 .06 124v 1 [ cs . SE] 7 Jul 2026  \nStatic Metrics Are Insufficient: Predicting Java Method Energy Usage with Execution Time  \nMuhammad Imran 1 , Vincenzo Stoico2 , and Ivano Malavolta2  \n1 University of L’Aquila, L’Aquila, Italy  \n[muhammad.imran@graduate.univaq.it](muhammad.imran@graduate.univaq.it)  \n2 Vrije Universiteit Amsterdam, Amsterdam, The Netherlands  \n[v.stoico@vu.nl](v.stoico@vu.nl), [i.malavolta@vu.nl](i.malavolta@vu.nl)  \nAbstract. 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  \n33 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 R 2 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.  \nKeywords: Software energy consumption · Method-level energy estimation · Source code metrics · Machine learning · Java  \n1 Introduction  \nEnergy consumption has emerged as a critical concern in modern software development, not only in mobile or embedded environments but also in generalpurpose computing. As software systems grow increasingly complex and resourceintensive, their energy footprints become non-trivial, impacting battery life, operational costs, and environmental sustainability [35] .  \nA significant part of the research in this domain relies on empirical measurements, as energy is strongly influenced by the execution environment of the application [10] . These measurements are obtained through repeated executionsin controlled environments, often using specialized profiling tools and hardware instrumentation [43] . Although these methods provide precise and reliable energy consumption data, they often require manual setup or hardware access to capture fine-grained data, which limits their routine use in development workflows [18] . Consequently, during refactoring or design, developers typically lack  \n2 Muhammad Imran, Vincenzo Stoico, and Ivano Malavolta  \naccessible ways to reason about energy consumption without repeated profiling [39] . The limitations of measurement-based approaches become especially clear when energy profiling is required at fine-grained levels, such as individual methods. Recent studies demonstrate that even small syntactic code changes can introduce measurable variations in energy usage, especially in compiled or performance-sensitive programs [38] .  \nDespite this growing recognition, few studies have systematically modeled energy consumption from static code features like cyclomatic complexity, loop depth, or library usage, especially at the method level. Multiple studies [20, 3] show static features influence energy by shaping control flow, computational intensity, and resource access, highlighting their importance in energy modeling. Most work focuses on coarse-grained estimation (language- or library-level) or hybrid methods requiring execution [38, 3] . This gap is particularly notable in Java, where low-level decisions such as collection types and loop constructs affect energy ","cbCaibFAQncTaQ9n","https://ap.wps.com/l/cbCaibFAQncTaQ9n","pdf",1920937,1,16,"English","en",105,"# Abstract\n# Introduction\n# Related Work","[{\"question\":\"为什么仅使用静态源代码指标难以预测 Java 方法能耗？\",\"answer\":\"研究发现静态源代码指标单独使用时的预测效果接近于零（平均 R2 接近 0），说明方法能耗很大程度受运行时行为影响，而非源代码结构本身。\"},{\"question\":\"在方法能耗预测中，加入执行时间带来了哪些提升？\",\"answer\":\"将执行时间作为轻量的动态输入后，预测精度显著提高，R2 可提升到 0.46，表明运行时特征对能耗主导作用更强。\"},{\"question\":\"哪些特征在预测 Java 方法能耗时最关键？\",\"answer\":\"研究指出执行时间、方法内部调用（internal method calls）以及圈复杂度（cyclomatic complexity）是最强的能耗预测因子。\"}]",1784192370,40,{"code":4,"msg":30,"data":31},"ok",{"site_id":24,"language":23,"slug":32,"title":13,"keywords":33,"description":14,"schema_data":34,"social_meta":85,"head_meta":87,"extra_data":89,"updated_unix":27},"static-metrics-are-insufficient-predicting-java-method-energy-usage-with-execution-time","",{"@graph":35,"@context":84},[36,53,67],{"@type":37,"itemListElement":38},"BreadcrumbList",[39,43,47,50],{"item":40,"name":41,"@type":42,"position":20},"https://docshare.wps.com","Home","ListItem",{"item":44,"name":45,"@type":42,"position":46},"https://docshare.wps.com/document/","Document",2,{"item":48,"name":12,"@type":42,"position":49},"https://docshare.wps.com/document/research-report/",3,{"item":51,"name":13,"@type":42,"position":52},"https://docshare.wps.com/document/static-metrics-are-insufficient-predicting-java-method-energy-usage-with-execution-time/84066/",4,{"url":51,"name":13,"@type":54,"author":55,"headline":13,"publisher":57,"fileFormat":60,"inLanguage":23,"description":14,"dateModified":61,"datePublished":61,"encodingFormat":60,"isAccessibleForFree":62,"interactionStatistic":63},"DigitalDocument",{"name":9,"@type":56},"Person",{"url":40,"name":58,"@type":59},"DocShare","Organization","application/pdf","2026-07-16",true,{"@type":64,"interactionType":65,"userInteractionCount":4},"InteractionCounter",{"@type":66},"ViewAction",{"@type":68,"mainEntity":69},"FAQPage",[70,76,80],{"name":71,"@type":72,"acceptedAnswer":73},"为什么仅使用静态源代码指标难以预测 Java 方法能耗？","Question",{"text":74,"@type":75},"研究发现静态源代码指标单独使用时的预测效果接近于零（平均 R2 接近 0），说明方法能耗很大程度受运行时行为影响，而非源代码结构本身。","Answer",{"name":77,"@type":72,"acceptedAnswer":78},"在方法能耗预测中，加入执行时间带来了哪些提升？",{"text":79,"@type":75},"将执行时间作为轻量的动态输入后，预测精度显著提高，R2 可提升到 0.46，表明运行时特征对能耗主导作用更强。",{"name":81,"@type":72,"acceptedAnswer":82},"哪些特征在预测 Java 方法能耗时最关键？",{"text":83,"@type":75},"研究指出执行时间、方法内部调用（internal method calls）以及圈复杂度（cyclomatic complexity）是最强的能耗预测因子。","https://schema.org",{"og:url":51,"og:type":86,"og:title":13,"og:site_name":58,"og:description":14},"article",{"robots":88,"canonical":51},"index,follow",{"doc_id":7,"site_id":24},{"code":4,"msg":5,"data":91},[92,96,100,104,109,114,118,121,126,129,133],{"id":20,"doc_module":4,"doc_module_name":45,"category_name":93,"show_sort_weight":94,"slug":95},"Story & Novel",90,"story-novel",{"id":46,"doc_module":4,"doc_module_name":45,"category_name":97,"show_sort_weight":98,"slug":99},"Literature",80,"literature",{"id":52,"doc_module":4,"doc_module_name":45,"category_name":101,"show_sort_weight":102,"slug":103},"Exam",70,"exam",{"id":105,"doc_module":4,"doc_module_name":45,"category_name":106,"show_sort_weight":107,"slug":108},5,"Comic",60,"comic",{"id":110,"doc_module":4,"doc_module_name":45,"category_name":111,"show_sort_weight":112,"slug":113},6,"Technology",50,"technology",{"id":115,"doc_module":4,"doc_module_name":45,"category_name":116,"show_sort_weight":28,"slug":117},7,"Healthcare","healthcare",{"id":11,"doc_module":4,"doc_module_name":45,"category_name":12,"show_sort_weight":119,"slug":120},30,"research-report",{"id":122,"doc_module":4,"doc_module_name":45,"category_name":123,"show_sort_weight":124,"slug":125},9,"Religion & Spirituality",20,"religion-spirituality",{"id":124,"doc_module":4,"doc_module_name":45,"category_name":127,"show_sort_weight":124,"slug":128},"World Cup","world-cup",{"id":130,"doc_module":4,"doc_module_name":45,"category_name":131,"show_sort_weight":130,"slug":132},10,"Lifestyle","lifestyle",{"id":134,"doc_module":4,"doc_module_name":45,"category_name":135,"show_sort_weight":105,"slug":136},19,"General","general"]