一句话:通过 15,000 次真实开发者补全案例研究,揭示合成基准高估代码补全性能,高耗时补全准确率不足 20%。
代码补全已集成到主流 IDE,但现有工具多依赖合成基准评估,这些基准能否反映真实开发场景尚不明确。本文对 66 名真实开发者实际应用的 15,000 次代码补全进行案例研究,并与人工构造的补全进行对比。结果显示,合成基准在多个方面未能反映真实补全:被评测工具在真实数据上的准确率远低于基准表现;在开发者耗时最多的少数补全上,预测准确率不足 20%,而这一现象在合成基准中不可见。作者据此呼吁基准应覆盖开发者最常用的补全(如项目内 API),模型应适应项目内数据,并强调真实开发者试验对衡量最难预测、最耗时且更典型的补全性能至关重要。
Code completion is commonly used by software developers and is integrated into all major IDE's. Good completion tools can not only save time and effort but may also help avoid incorrect API usage. Many proposed completion tools have shown promising results on synthetic benchmarks, but these benchmarks make no claims about the realism of the completions they test. This lack of grounding in real-world data could hinder our scientific understanding of developer needs and of the efficacy of completion models. This paper presents a case study on 15,000 code completions that were applied by 66 real developers, which we study and contrast with artificial completions to inform future research and tools in this area. We find that synthetic benchmarks misrepresent many aspects of real-world completions; tested completion tools were far less accurate on real-world data. Worse, on the few completions that consumed most of the developers' time, prediction accuracy was less than 20% -- an effect that is invisible in synthetic benchmarks. Our findings have ramifications for future benchmarks, tool design and real-world efficacy: Benchmarks must account for completions that developers use most, such as intra-project APIs; models should be designed to be amenable to intra-project data; and real-world developer trials are essential to quantifying performance on the least predictable completions, which are both most time-consuming and far more typical than artificial data suggests. We publicly release our preprint [https://doi.org/10.5281/zenodo.2565673] and replication data and materials [https://doi.org/10.5281/zenodo.2562249].
@inproceedings{HellendoornPGB19,
title = {When Code Completion Fails: A Case Study on Real-World Completions},
author = {Vincent J. Hellendoorn and Sebastian Proksch and Harald C. Gall and Alberto Bacchelli},
booktitle = {ICSE},
year = {2019},
doi = {10.1109/icse.2019.00101}
}