Python Under the Microscope: A Comparative Energy Analysis of Execution Methods
As environmental awareness grows and the world heads toward carbon neutrality, the energy efficiency of software systems has become an increasingly major topic of research. Python, known for its readability and vast ecosystem, is widely used in many domains, from data science to back-end development, despite ongoing concerns about its execution speed and energy consumption. Although there are various optimization methods and alternative interpreters available for Python, there still remains a lack of indepth research directly comparing their runtime performance and energy efficiency. To bridge this gap, our research has evaluated five widely used Python execution approaches: standard interpretation with CPython, ahead-of-time compilation through Cython, just-in-time compilation using PyPy, bytecode compilation via py_compile, and the foreign function interface method using ctypes. Using 15 benchmark algorithms adapted from the Computer Language Benchmarks Game and a suite of software profiling tools, we introduced GreenScore—a composite metric that integrates normalized carbon emissions, execution time, and energy consumption. Our findings reveal that FFI-based execution through ctypes achieved the best results, with the lowest energy use (17.9 J), fastest runtime (2.88 s) and smallest carbon footprint (0.009 gCO2eq), outperforming the CPython baseline. PyPy and Cython also performed well, whereas py_compile offered minimal improvement. To ensure the robustness and reliability of these findings, statistical significance testing, standard deviation analysis, and both real and synthetic survey-based validations were conducted. These validations reinforce the consistency and practical credibility of the results, offering actionable insights for developing energy-efficient and sustainable Python applications.
Authors
- Md. Naimur Rahman (ORCID: https://orcid.org/0000-0001-5236-3784)
- Md. Abdul Hakim Khan (ORCID: https://orcid.org/0000-0003-2700-6261)
- Md. Motaharul Islam (ORCID: https://orcid.org/0000-0002-8030-3225)
- Md. Mahmudul Hasan (ORCID: https://orcid.org/0009-0006-9400-8733)
- Sabbir Ahmed
- Md. Fatin Shadab Turja
- Adiba Irin
Institutions
- Dhaka International University (BD)
- United International University (BD)
Publication Details
- Journal
- IEEE Access
- Published
- 2025-01-01
- DOI
- https://doi.org/10.1109/access.2025.3630507
- Primary Topic
- Green IT and Sustainability
- Type
- article
- Field-Weighted Citation Impact
- 0.00