ABSTRACT
The current concern about global warming has led to an increasing interest in the energy efficiency of computer applications. Assuming power is constant, the general trend is that faster programs will consume less energy, thus optimizing a program for speed would also improve its energy efficiency.
We investigate this tendency in a set of C++ solutions mined from CSES (Code Submission Evaluation System), a popular programming competition site. Each CSES problem has several test cases, where a test case consists of a given input and its corresponding output. In order to be considered correct, the C++ solution of a user for a given problem must give for each of its test cases, under a given time limit, the expected answer. In such context, we can consider that all correct solutions for a problem were written with a speed concern, but not with energy efficiency in mind.
We selected 15 problems from CSES and for each of them we mined 30 C++ solutions, trying to select the faster and the slower ones, as also some randomly chosen solutions. Then, we evaluated the time and energy efficiency of each solution in two different machines.
In our scenario, where there is a great diversity of programming styles, execution speed and memory usage, we could confirm the general trend, where the faster programs consume less energy. Moreover, by using the least square method, we were able to predict with good precision the energy consumption of a program based on its execution time. A manual analysis of the programs with unexpected energy consumption revealed that often their memory usage is different when compared to programs with similar execution times.
Besides helping to confirm that faster programs usually are more energy-efficient than slower ones, our results seem to indicate that our approach to predict the energy consumption of a program can help to automatically identify programs with abnormal energy consumption. Finally, our test framework, which comprises the benchmark with 450 C++ programs, the analysis script and the test results, is publicly available.
- Dirk Beyer and Philipp Wendler. 2020. CPU Energy Meter: A tool for energy-aware algorithms engineering. In Tools and Algorithms for the Construction and Analysis of Systems: 26th International Conference, TACAS 2020, Held as Part of the European Joint Conferences on Theory and Practice of Software, ETAPS 2020, Dublin, Ireland, April 25–30, 2020, Proceedings, Part II 26. Springer, 126–133.Google ScholarDigital Library
- Richard Burden and J. Douglas Faires. 2016. Análise numérica (3ª edição ed.). Cengage Learning.Google Scholar
- Marco Couto, Rui Pereira, Francisco Ribeiro, Rui Rua, and João Saraiva. 2017. Towards a Green Ranking for Programming Languages. In Proceedings of the 21st Brazilian Symposium on Programming Languages (Fortaleza, CE, Brazil) (SBLP ’17). Association for Computing Machinery, New York, NY, USA, Article 7, 8 pages. https://doi.org/10.1145/3125374.3125382Google ScholarDigital Library
- Erol Gelenbe and Yves Caseau. 2015. The Impact of Information Technology on Energy Consumption and Carbon Emissions. Ubiquity 2015, June, Article 1 (jun 2015), 15 pages. https://doi.org/10.1145/2755977Google ScholarDigital Library
- Marcus Hähnel, Björn Döbel, Marcus Völp, and Hermann Härtig. 2012. Measuring energy consumption for short code paths using RAPL. ACM SIGMETRICS Performance Evaluation Review 40, 3 (2012), 13–17.Google ScholarDigital Library
- Barbara Illowsky and Susan Dean. 2023. Book: Introductory Statistics (OpenStax). https://stats.libretexts.org/Bookshelves/Introductory_Statistics/Book%3A_Introductory_Statistics_(OpenStax)Google Scholar
- Jaimie Kelley, Christopher Stewart, Devesh Tiwari, and Saurabh Gupta. 2016. Adaptive power profiling for many-core HPC architectures. In 2016 IEEE International Conference on Autonomic Computing (ICAC). IEEE, 179–188.Google ScholarCross Ref
- Kashif Nizam Khan, Mikael Hirki, Tapio Niemi, Jukka K. Nurminen, and Zhonghong Ou. 2018. RAPL in Action: Experiences in Using RAPL for Power Measurements. 3, 2 (2018), 1–26. https://doi.org/10.1145/3177754Google ScholarDigital Library
- Antti Laaksonen. 2020. Guide to competitive programming. Springer.Google Scholar
- Charalampos Marantos, Lazaros Papadopoulos, Christos P Lamprakos, Konstantinos Salapas, and Dimitrios Soudris. 2022. Bringing Energy Efficiency closer to Application Developers: An Extensible Software Analysis Framework. IEEE Transactions on Sustainable Computing (2022).Google Scholar
- Gayle Laakmann McDowell. 2015. Cracking the coding interview: 189 programming questions and solutions. CareerCup, LLC.Google Scholar
- John Mongan, Noah Suojanen Kindler, and Eric Giguère. 2012. Programming interviews exposed: secrets to landing your next job. John Wiley & Sons.Google Scholar
- Jerome L. Myers and A. (Arnold) Well. [n. d.]. Research design and statistical analysis. Mahwah, N.J. : Lawrence Erlbaum Associates. http://archive.org/details/researchdesignst00jero_935Google Scholar
- Adel Noureddine. 2022. PowerJoular and JoularJX: Multi-Platform Software Power Monitoring Tools. In 2022 18th International Conference on Intelligent Environments (IE). 1–4. https://doi.org/10.1109/IE54923.2022.9826760Google ScholarCross Ref
- Rui Pereira, Marco Couto, Francisco Ribeiro, Rui Rua, Jácome Cunha, João Paulo Fernandes, and João Saraiva. 2017. Energy Efficiency across Programming Languages: How Do Energy, Time, and Memory Relate?. In Proceedings of the 10th ACM SIGPLAN International Conference on Software Language Engineering (Vancouver, BC, Canada) (SLE 2017). Association for Computing Machinery, New York, NY, USA, 256–267. https://doi.org/10.1145/3136014.3136031Google ScholarDigital Library
- Rui Pereira, Marco Couto, Francisco Ribeiro, Rui Rua, Jácome Cunha, João Paulo Fernandes, and João Saraiva. 2021. Ranking programming languages by energy efficiency. Science of Computer Programming 205 (2021), 102609.Google ScholarCross Ref
- Gustavo Pinto, Anthony Canino, Fernando Castor, Guoqing Xu, and Yu David Liu. 2017. Understanding and overcoming parallelism bottlenecks in ForkJoin applications. In 2017 32nd IEEE/ACM International Conference on Automated Software Engineering (ASE). 765–775. https://doi.org/10.1109/ASE.2017.8115687Google ScholarCross Ref
- Gustavo Pinto and Fernando Castor. 2017. Energy Efficiency: A New Concern for Application Software Developers. Commun. ACM 60, 12 (nov 2017), 68–75. https://doi.org/10.1145/3154384Google ScholarDigital Library
- Gustavo Pinto, Fernando Castor, and Yu David Liu. 2014. Understanding Energy Behaviors of Thread Management Constructs. SIGPLAN Not. 49, 10 (oct 2014), 345–360. https://doi.org/10.1145/2714064.2660235Google ScholarDigital Library
- John S. Seng and Dean M. Tullsen. 2003. The Effect of Compiler Optimizations on Pentium 4 Power Consumption. In Proceedings of the Seventh Workshop on Interaction between Compilers and Computer Architectures(INTERACT ’03). IEEE Computer Society, USA, 51.Google Scholar
- Steven S Skiena. 2008. The algorithm design manual (2 ed.). Springer.Google Scholar
- Vincent M Weaver, Matt Johnson, Kiran Kasichayanula, James Ralph, Piotr Luszczek, Dan Terpstra, and Shirley Moore. 2012. Measuring energy and power with PAPI. In 2012 41st international conference on parallel processing workshops. IEEE, 262–268.Google ScholarDigital Library
- Matt N Williams, Carlos Alberto Gómez Grajales, and Dason Kurkiewicz. 2013. Assumptions of multiple regression: Correcting two misconceptions. Practical Assessment, Research, and Evaluation 18, 1 (2013), 11.Google Scholar
- Tomofumi Yuki and Sanjay Rajopadhye. 2014. Folklore Confirmed: Compiling for Speed Compiling for Energy. In Languages and Compilers for Parallel Computing: 26th International Workshop, LCPC 2013, San Jose, CA, USA, September 25–27, 2013. Revised Selected Papers. Springer, 169–184.Google Scholar
Index Terms
- Analyzing the Time x Energy Relation in C++ Solutions Mined from a Programming Contest Site
Recommendations
Energy efficiency across programming languages: how do energy, time, and memory relate?
SLE 2017: Proceedings of the 10th ACM SIGPLAN International Conference on Software Language EngineeringThis paper presents a study of the runtime, memory usage and energy consumption of twenty seven well-known software languages. We monitor the performance of such languages using ten different programming problems, expressed in each of the languages. ...
Performance evaluation of energy efficient ethernet
Until very recently, energy efficiency has received little attention in many wired communications environments. For example, in most current Ethernet standards the transmitter and receiver operate at full power even when no data is being sent. However, ...
Conserving energy in real-time storage systems with I/O burstiness
Energy conservation has become a critical problem for real-time embedded storage systems. Although a variety of approaches for reducing energy consumption have been extensively studied, energy conservation for real-time embedded storage systems is still ...
Comments