Evaluating the Energy Efficiency of Optimization Techniques in C, Python, and Java
Carlos Pulido, Félix García, Ma Ángeles Moraga, Miguel Baños‐González, Juan Antonio Rico‐Gallego, Javier Corral‐GarcíaABSTRACT
Background
Software plays a critical role in modern society, but its energy consumption is a growing concern. This issue is especially evident in the Internet of Things (IoT), which involves billions of devices operating under strict energy constraints, most of which rely on C Programming Language (PL) because of its energy efficiency. Outside of IoT, PLs like Python and Java have gained popularity despite being less energy‐efficient, particularly Python. Optimization is therefore essential to reduce energy use in both contexts: (i) in the IoT, where the large number of devices causes high cumulative energy consumption despite using C; and (ii) for Python and Java, given their widespread adoption and higher energy demands. However, software optimizations do not always lead to lower energy consumption. Therefore, their impact on energy efficiency must be evaluated carefully.
Method
This article evaluates the energy impact of 26 optimization techniques in C, Python, and Java across different compiler and runtime configurations. The main focus is on comparing baseline and optimized implementations under each configuration. In addition, the study investigates the effect of compiler and runtime settings—such as
Results
The results show that Python achieved the best overall improvement, with 58% of the optimization techniques resulting in energy savings, achieving reductions of up to 70.38%. However, despite this high effectiveness in reducing energy consumption, Python still exhibits the highest overall energy consumption among the three PLs.