[论文解读] Measuring the Runtime Performance of C++ Code Written by Humans using GitHub Copilot
本研究通过一项包含32名系统程序员的用户研究,评估了GitHub Copilot生成的C++代码与人工编写的代码在运行时性能上的差异。结果显示,Copilot辅助的解决方案平均慢26%(I/O操作)和15%(并发编程),表明尽管Copilot有助于提高正确性,但可能妨碍性能优化。
GitHub Copilot is an artificially intelligent programming assistant used by many developers. While a few studies have evaluated the security risks of using Copilot, there has not been any study to show if it aids developers in producing code with better runtime performance. We evaluate the runtime performance of C++ code produced when developers use GitHub Copilot versus when they do not. To this end, we conducted a user study with 32 participants where each participant solved two C++ programming problems, one with Copilot and the other without it and measured the runtime performance of the participants' solutions on our test data. Our results suggest that using Copilot may produce C++ code with (statistically significant) slower runtime performance.
研究动机与目标
- 调查GitHub Copilot是否会影响开发者所编写C++代码的运行时性能。
- 评估Copilot是否引导开发者选择运行时性能更优或更差的代码实现。
- 考察开发者经验或对C++的熟悉程度是否会影响使用Copilot时的性能结果。
- 为AI辅助编程在系统编程中的性能权衡提供实证证据。
- 为在性能关键型软件开发中整合AI编码助手提供最佳实践指导。
提出的方法
- 开展了一项受控的用户研究,邀请32名经验丰富的C++开发者解决两个不同的编程问题:一个涉及I/O操作,另一个涉及并发编程。
- 每位参与者在两种条件下各解决一次问题——一次启用GitHub Copilot,一次不启用——采用被试内设计以控制个体差异。
- 在标准化测试数据集上测量并比较所有有效解决方案的运行时性能。
- 收集并分析了参与者会话的视频记录,以理解其编码过程中的决策模式。
- 在任务结束后发放调查问卷,评估开发者的感知、偏好以及对Copilot影响其选择的看法。
- 使用统计假设检验(t检验)评估Copilot辅助与非Copilot解决方案之间性能差异的显著性。
实验结果
研究问题
- RQ1RQ0:使用Copilot是否会影响程序的正确性?
- RQ2RQ1:使用GitHub Copilot时,代码是否存在运行时性能差异?
- RQ3RQ2:Copilot的建议是否引导开发者选择运行时性能更优或更差的代码?
- RQ4RQ3:Copilot用户自身特征是否会影响其使用时的运行时性能?
主要发现
- 在I/O操作问题中,Copilot辅助解决方案的平均运行速度比非Copilot解决方案慢26%,且p值为0.0172,具有统计显著性。
- 在并发编程问题中,Copilot辅助解决方案的平均运行速度慢15%,但差异未达统计显著性(p = 0.667)。
- 专家编写的解决方案在运行时性能上可达到平均Copilot辅助解决方案的六倍。
- 在I/O问题中,使用Copilot与运行时性能变慢之间存在强正相关关系;而在并发编程问题中,相关性较弱。
- 更高的C++专业水平和语言熟悉度与更快的运行时性能相关,无论是否使用Copilot。
- Copilot的建议往往引导开发者选择性能更差的实现,尤其在I/O和并发等性能敏感领域。
阅读本论文
在 Nubint 阅读器中打开原文,边读边就任意段落提问。
在 Nubint 中阅读本论文本解读由 AI 根据论文原文生成,引用前请核对原文。