Who Wins the Race? (R Vs Python) - An Exploratory Study on Energy Consumption of Machine Learning Algorithms
Rajrupa Chattaraj, Sridhar Chimalakonda, Vibhu Saujanya Sharma, Vikrant Kaulgud · 2025
Read Who Wins the Race? (R Vs Python) - An Exploratory Study on Energy Consumption of Machine Learning Algorithms by Rajrupa Chattaraj, Sridhar Chimalakonda, Vibhu Saujanya Sharma, Vikrant Kaulgud (2025) in the Tower of Babel, a free online library of public-domain works preserved in clean, searchable text. No sign-up. The full text is served as a plain-text file at a predictable URL, where text is present: https://antarctic-labs.com/tower-of-babel/arxiv-2508-17344.txt.
Introduction
Rajrupa Chattaraj and co-authors race two programming languages on green computing grounds in a 2025 study. Machine learning is everywhere in modern software, but training and running models burn real energy and emit real carbon. Accuracy and speed get studied endlessly; the power bill rarely does. The authors ask a pointed question for the two favorite languages of data work: R versus Python.
They measured energy use and run time for five machine learning algorithms across both languages, in training and in use. The exploratory study is less about crowning a winner than about making the cost visible. Language choice is usually made on libraries and habit, never on watts. Results of this kind give teams a new axis for decisions, and they nudge the field to report energy alongside accuracy.
Catalog record
| CREATOR | Rajrupa Chattaraj, Sridhar Chimalakonda, Vibhu Saujanya Sharma, Vikrant Kaulgud |
|---|---|
| YEAR | 2025 |
| COLLECTION | PAPERS |
| FORMAT | TXT |
| FILE SIZE | 76 KB |
| VERSION | 1.0 |
| LICENSE | http://creativecommons.org/licenses/by/4.0/ |
| RIGHTS | CC BY |
| SOURCE | arXiv |
Source: https://arxiv.org/abs/2508-17344
Browse the full library · About the Tower of Babel
Full text
The opening of the work, from the library's hosted text:
Who Wins the Race? (R Vs Python) - An Exploratory Study on Energy Consumption of Machine Learning Algorithms Rajrupa Chattaraj, Sridhar Chimalakonda, Vibhu Saujanya Sharma, Vikrant Kaulgud Abstract The utilization of Machine Learning (ML) in contemporary software systems is extensive and continually expanding. However, its usage is energy-intensive, contributing to increased carbon emissions and demanding significant resources. While numerous studies examine the performance and accuracy of ML, only a limited few focus on its environmental aspects, particularly energy consumption. In addition, despite emerging efforts to compare energy consumption across various programming languages for specific algorithms and tasks, there remains a gap specifically in comparing these languages for ML-based tasks. This paper aims to raise awareness of the energy costs associated with employing different programming languages for ML model training and inference. Through this empirical study, we measure and compare the energy consumption along with run-time performance of five regression and five classification tasks implemented in Python and R, the two most popular programming languages in this context. Our study results reveal a statistically significant difference in costs between the two languages in 95% of the cases examined. Furthermore, our analysis demonstrates that the choice of programming language can influence energy efficiency significantly, up to 99.16% during model training and up to 99.8% during inferences, for a given ML task. 1 Introduction Artificial intelligence (AI) and Machine learning (ML) have become pervasive today, influencing various facets of our lives. Research indicates that over 77 percent of industrial companies have integrated AI into at least one of their operational functions 1 1 1 https://explodingtopics.com/blog/companies-using-ai . The utilization of AI and ML technologies demands significant computational cost. According to a study done by MIT, the training of a single AI model can result in emissions exceeding 626,000 pounds of carbon dioxide which is equivalent to almost five times the lifetime emissions of an average American car [ 1 ] . This has prompted discussions concerning the environmental impacts and the imperative for energy-efficient solutions have stimulated research in the realm of Green Software Engineering (SE) [ 2 ] . Given the global reach and impact of AI and ML, it has become crucial for developers and practitioners to consider informed decision in energy consumption and the carbon footprint of software throughout its development and deployment processes. Machine learning enthusiasts and data scientists commonly favor Python as their primary programming languages for extracting valuable insights from data. According to survey done in 2023, 69 percent of machine learning developers and data scientists now use Python 2 2 2 https://adtmag.com/articles/2019/04/11/developer-economics.aspx# . Its popularity in these fields can be credited to its developer-friendly syntax, the presence of comprehensive libraries like TensorFlow, PyTorch, and an active developer community [ 3 ] . R also holds an important position as a popular programming language in the sphere of machine learning and statistics [ 4 ] . Its strengths lie in the extensive range of packages it provides for tasks such as data manipulation and statistical analysis. While developers and practitioners often base their programming language choices on various features and characteristics [ 5 ] , it is also critical to consider the associated energy costs given their potential environmental impact. Research has demonstrated that selection of programming languages [ 6 , 7 ] play a crucial role in determining the energy consumption of software components. Various programming languages exhibit differing levels of efficiency concerning speed, memory usage, and energy utilization [ 8 ] . Studies have indicated that the choice of programming language can result in more energy-efficient algorithm implementations, while others may lead to less efficiency. For instance, opting for JavaScript over the Swift programming language has been found to potentially increase energy efficiency by up to 12,694% [ 5 ] . While different programming languages have been compared for specific algorithms and tasks based on energy consumption, there has been a lack of evaluation concerning the energy consumption of programming languages within the context of machine learning algorithms and tasks. This paper presents an in-depth empirical analysis to investigate and compare the energy consumption and run-time performance of various machine learning algorithms. The study includes five classification tasks and five regression tasks for both model training and inferences, utilizing the standard libraries of R and Python. In the context of ML, scikit-learn stands out as the most popular Python library [ 9 ] , offering a comprehensive set of implementations for ML algorithms. CRAN serves as a network of FTP and web servers globally, providing up-to-date versions of code and documentation for R 3 3 3 https://cran.r-project.org , thus representing the R ecosystem broadly in the ML domain. scikit-learn and CRAN are widely recognized as foundational resources for ML practitioners in Python and R, respectively. Thus, we believe, comparing implementations from these two standard packages represent comparison of respective programming languages from an energy consumption perspective. However, as a further exploration, we also discuss our results on experimenting scratch-level implementations for Python. Our aim is to investigate which programming language among Python and R, offers more energy and run-time efficient implementation for specific tasks during machine learning model training and inferences. Through this work, we aim to provide insights into the decision-making process regarding the selection of a programming language for specific machine learning tasks throughout their development and deployment stages. Our methodology consists of using various machine learning algorithms for classification and regression tasks, running them through model training and inference phases with 3 different datasets from UCI Machine Learning Repository 4 4 4 https://archive.ics.uci.edu and Kaggle 5 5 5 https://www.kaggle.com/datasets . Subsequently, we measure the energy consumption of each task independently. The energy consumption experiments were facilitated by utilizing energy consumption tools pyJoules 6 6 6 https://pypi.org/project/pyJoules/ (for Python) and RJoules [ 10 ] (for R). Both of these tools are developed by leveraging the commonly used Intel-RAPL (Running Average Power Limit) interface [ 11 ] . To the best of our knowledge, this is the first empirical study that measures the energy consumption and run-time performance of machine learning algorithms and tasks from a programming language perspective. We found that R is more energy and run-time efficient for regression algorithms, while Python is better for classification algorithms. Our results indicate that neither R nor Python is universally the most energy or run-time efficient choice across all the algorithms. Thus, ML engineers should carefully select the programming language based on specific tasks and contexts. The rest of the paper is organized as follows. Section 2 covers the Related Work. Research Questions are outlined in Section 3 , while Section 4 specifies the addressed ML Tasks. The utilized Datasets are detailed in Section 5 , and Section 6 describes the Experimental Procedure. Findings from the experiments are provided in Section 7 . Potential threats impacting the study’s validity are discussed in Section 8 . Lastly, the Discussion and Conclusion are presented in Section 9 and Section 10 , respectively. 2 Related Work In recent years, there has been a growing emphasis on examining the energy consumption of software components, leading to extensive exploration and analysis in diverse domains. The primary objective of these studies is to equip developers with valuable insights that aid in selecting