一句话:提出项目级代码效率优化框架 PEACE,通过依赖感知的混合代码编辑在保证正确性下提升执行效率。
现有基于LLM的代码效率优化多局限于函数级,忽略函数间交互,难以适用于真实项目;代码编辑虽可用于项目级优化,却存在无效编辑和内部函数次优问题。本文提出PEACE,一种混合代码编辑框架,包含依赖感知的优化函数序列构建、有效关联编辑识别和优化编辑迭代三阶段,并保持项目整体正确性与完整性。作者构建PEACEXEC基准,涵盖47个GitHub Python项目、146个真实优化任务及可执行环境。实验表明,PEACE达到69.2% pass@1正确率、+46.9%优化率和0.840加速比,显著优于SOTA,尤其在多函数复杂任务中,并验证了各组件与混合设计的有效性。
Large Language Models (LLMs) have demonstrated significant capability in code generation, but their potential in code efficiency optimization remains underexplored. Previous LLM-based code efficiency optimization approaches exclusively focus on function-level optimization and overlook interaction between functions, failing to generalize to real-world development scenarios. Code editing techniques show great potential for conducting project-level optimization, yet they face challenges associated with invalid edits and suboptimal internal functions. To address these gaps, we propose PEACE, a novel hybrid framework for Project-Level code Efficiency optimization through Automatic Code Editing, which also ensures the overall correctness and integrity of the project. PEACE integrates three key phases: dependency-aware optimizing function sequence construction, valid associated edits identification, and efficiency optimization editing iteration. To rigorously evaluate the effectiveness of PEACE, we construct PEACEXEC, the first benchmark comprising 146 real-world optimization tasks from 47 high-impact GitHub Python projects, along with highly qualified test cases and executable environments. Extensive experiments demonstrate PEACE’s superiority over the state-of-the-art baselines, achieving a 69.2% correctness rate (pass@1), +46.9% opt rate, and 0.840 speedup in execution efficiency. Notably, our PEACE outperforms all baselines by significant margins, particularly in complex optimization tasks with multiple functions. Moreover, extensive experiments are also conducted to validate the contributions of each component in PEACE, as well as the rationale and effectiveness of our hybrid framework design.
DOI 原文 ·
@inproceedings{paperbot9518,
title = {PEACE: Towards Efficient Project-Level Efficiency Optimization via Hybrid Code Editing},
author = {Xiaoxue Ren and Jun Wan and Yun Peng and Zhongxin Liu and Ming Liang and Dajun Chen and Wei Jiang and Yong Li},
booktitle = {ASE},
year = {2025},
doi = {10.1109/ase63991.2025.00153}
}