EnCoDe: Energy Estimation of Source Code At Design-Time
ML models predict energy hotspots before code runs—80.6% accuracy, no execution needed.
Software energy efficiency is increasingly critical for sustainability and cost, but traditional profiling tools only measure energy at runtime and at coarse granularity (process or method level). They miss the energy impact of small code blocks like functions, loops, and conditionals. To fix this, Shailender Goyal and colleagues from IIIT Hyderabad developed EnCoDe (Energy Estimation of Source Code at Design-Time), presented at EASE 2026. The paper introduces PowerLens, a novel measurement methodology that captures reliable sub-millisecond energy readings for tiny code blocks. They then analyzed over 18,000 Python programs to build a fine-grained dataset, uncovering linear and non-linear relationships between static code features (structural, complexity, density, contextual) and energy consumption.
Using this dataset, the team trained machine learning models to estimate and classify block-level energy consumption at design-time—without execution. Their regressors achieved an R² of 0.75, and their classifiers reached 80.6% accuracy in identifying energy hotspots. This means developers can now pinpoint inefficient code early in the development process, compare alternative implementations, and optimize energy consumption proactively. EnCoDe is a significant step toward making energy awareness a first-class concern in software engineering, much like performance or memory usage.
- PowerLens enables reliable sub-millisecond energy readings for small code blocks, a first in software profiling.
- Study analyzed 18,000+ Python programs to create a fine-grained dataset linking static code features to energy consumption.
- ML models achieve R²=0.75 for regression and 80.6% classification accuracy, allowing design-time hotspot detection without execution.
Why It Matters
Enables developers to optimize energy efficiency early in development, reducing costs and environmental impact.