arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2412.14877cs.PL
收藏

研究从编程竞赛网站挖掘的C++和Java解决方案的能耗

Investigating the Energy Consumption of C++ and Java Solutions Mined from a Programming Contest Site

Sérgio Queiroz de Medeiros, Marcelo Borges Nogueira, Gustavo Quezado

AI总结:

研究从CSES挖掘的C++和Java竞赛解决方案,验证了更快的程序能耗更低,并利用最小二乘法拟合能耗与执行时间的线性关系,实现异常能耗识别和问题分类搜索空间缩减50%以上。

摘要:

对全球变暖的担忧增加了人们对计算机应用能效的兴趣。假设功率是恒定的,一般趋势是更快的程序消耗更少的能量,因此为速度优化程序也会提高其能效。我们在从 Code Submission Evaluation System (CSES)(一个流行的编程竞赛网站)挖掘的一组 C++ 和 Java 解决方案中调查了这一趋势,其中每个解决方案必须在给定的时间限制内给出正确答案。在这种情况下,我们可以认为某个问题的所有正确解决方案都是在关注速度的情况下编写的,而不是考虑到能效。我们从 CSES 中选择了 15 个问题,并为每个问题挖掘了至少 30 个 C++ 和 Java 解决方案,在至少两台不同的机器上评估每个解决方案的时间和能效。在我们的场景中,编程风格、执行速度和内存使用存在很大的多样性,我们能够确认一般趋势:更快的程序消耗更少的能量。此外,我们能够使用普通最小二乘法拟合一个具有良好精度的线性函数,该函数根据程序的执行时间关联其能耗,以及自动识别能耗异常的程序。对这些程序的手动分析表明,与具有相似执行时间的程序相比,它们通常执行不同数量的分配和释放操作。我们还计算了这 15 个 CSES 问题的随机 C++ 解决方案集的能耗配置文件,并尝试通过使用先前为每个问题计算的能耗配置文件将每个集合与其对应的 CSES 问题相关联。通过这种方法,我们针对每个随机 C++ 解决方案集,将分类任务限制在 7 个 CSES 问题的子集中,搜索空间减少了 50% 以上。

英文摘要:

The concern about global warming increased the interest in the energy efficiency of computer applications. Assuming power is constant, the general trend is that faster programs consume less energy, thus optimizing a program for speed would also improve its energy efficiency. We investigate this tendency in a set of C++ and Java solutions mined from Code Submission Evaluation System (CSES), a popular programming competition site, where each solution must give the correct answer under a given time limit. 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 at least 30 C++ and Java solutions, evaluating time and energy efficiency of each solution in at least 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: faster programs consume less energy. Moreover, we were able to use ordinary least squares to fit a linear function, with good precision, that relates energy consumption of a program based on its execution time, as well as to automatically identify programs with abnormal energy consumption. A manual analysis of these programs revealed that often they perform a different amount of allocation and deallocation operations when compared to programs with similar execution times. We also calculated the energy consumption profile of sets of random C++ solutions for these 15 CSES problems, and we tried to associate each set with its corresponding CSES problem by using the energy consumption profiles previously computed for each one of them. With this approach, we restricted, for each set of random C++ solutions, the classification task to a subset of 7 CSES problems, a reduction of more than 50% in the search space.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑