一句话:OptCD 动态检测持续开发构建中生成却从未被读取的文件,定位负责生成它们的构建任务并自动生成禁用补丁。
持续开发(CD)构建通常包含编译、测试、静态分析等任务,任务越多构建越慢;其中一些任务产出的文件(如从未被读取或上传的覆盖率文件)根本无人使用,白白消耗构建时间。本文提出 OptCD,在构建运行时跟踪文件的读写,把“被写入却从未被读取”的文件判为不必要内容,再依据文件名将其映射到负责生成这些文件的具体构建任务,并用 ChatGPT 生成修改构建配置的补丁以禁用这些生成。在 22 个开源项目上的评估显示:95.6% 的项目至少存在一个内容全无用的未使用目录,OptCD 为其中 92.0% 找对了生成任务,并为 72.0% 生成了补丁,平均缩短 7.0% 的构建运行时;提交的 26 个 PR 中 12 个已被接受,5 个被拒,9 个待定。
Continuous development (CD) helps developers quickly release and update their software. To enact CD, developers customize their CD builds to perform several tasks, including compiling, testing, static analysis checks, etc. However, as developers add more tasks to their builds, the builds take longer to run, therefore slowing down the entire CD process. Furthermore, developers may unknowingly include tasks into their builds whose results are not used (e.g., generating coverage files that are never read or uploaded anywhere), therefore wasting build runtime doing unnecessary tasks. We propose OptCD, a technique to dynamically detect unnecessary work within CD builds. Our intuition is that unnecessary work can be identified by the generation of files that are not used by any other task within the build. OptCD runs alongside a CD build, tracking the generated files during the build and which files are read/written. Files that are written to but are never read from are unnecessary content from a build. Based on the names of the unnecessary files, OptCD then maps the files to the specific build tasks responsible for generating or writing to those files. Finally, OptCD leverages ChatGPT to suggest changing the build configuration to disable generating these unnecessary files. Our evaluation of OptCD on 22 open-source projects finds that 95.6% of projects generate at least one unused directory, a directory whose contents are all unnecessarily generated. OptCD identifies the correct task that generates 92.0% of the unused directories. Further, OptCD can produce a patch for the CD configuration file to prevent generating 72.0% of the unused directories. Using the patches, we reduce the runtime by 7.0% on average for the projects we studied. We submitted 26 pull requests for the unused directories that we could disable. Developers have accepted 12 of them, with five rejected, and nine still pending.
@inproceedings{BaralRCBTSL23,
title = {Optimizing Continuous Development by Detecting and Preventing Unnecessary Content Generation},
author = {Talank Baral and Shanto Rahman and Bala Naren Chanumolu and Başak Balcı and Tuna Tuncer and August Shi and Wing Lam},
booktitle = {ASE},
year = {2023},
doi = {10.1109/ase56229.2023.00216}
}