arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2510.17142cs.SE
收藏

PEACE:通过混合代码编辑实现高效的项目级效率优化

PEACE: Towards Efficient Project-Level Efficiency Optimization via Hybrid Code Editing

Hangzhou High-Tech Zone (Binjiang) Institute of Blockchain and Data Security, Zhejiang University(浙江大学杭州高技区(滨江)区块链与数据安全研究院);The Chinese University of Hong Kong(香港中文大学)

Xiaoxue Ren, Jun Wan, Yun Peng, Zhongxin Liu, Ming Liang, Dajun Chen, Wei Jiang, Yong Li

AI总结:

针对函数级优化忽视跨函数交互的问题,本文提出混合代码编辑框架Peace,并构建PeacExec基准,验证其在真实项目级效率优化上的显著优势。

摘要:

大型语言模型(LLM)在代码生成方面已展现出显著能力,但它们在代码效率优化方面的潜力仍未得到充分探索。以往基于LLM的代码效率优化方法只关注函数级优化,忽视函数之间的交互,无法泛化到真实开发场景。代码编辑技术在执行项目级优化方面展现出巨大潜力,但也面临无效编辑和内部函数次优的挑战。为弥补这些空白,我们提出Peace,这是一种通过自动代码编辑进行项目级代码效率优化的新型混合框架,同时确保项目的整体正确性和完整性。Peace集成三个关键阶段:依赖感知的优化函数序列构建、有效关联编辑识别,以及效率优化编辑迭代。为严格评估Peace的有效性,我们构建PeacExec,这是首个包含来自47个高影响力GitHub Python项目的146项真实优化任务的基准,并配有高质量测试用例和可执行环境。大量实验表明,Peace优于最先进基线,实现69.2%的正确率(pass@1)、+46.9%的优化率以及0.840的执行效率加速。值得注意的是,我们的Peace以显著优势超过所有基线,尤其是在涉及多个函数的复杂优化任务中。此外,我们还进行大量实验,以验证Peace中每个组件的贡献,以及混合框架设计的合理性和有效性。

英文摘要:

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.

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

↑