EUVIMEDEUVIMED entdecken
Open Access · CC BY 4.0

SemOpt: LLM-Driven Code Optimization via Rule-Based Analysis

Yuwei Zhao, Yuan-An Xiao, Qianyu Xiao, Zhao Zhang, Yingfei Xiong

ACM Transactions on Software Engineering and Methodology · 30.11.2026 · 35 (11) · 1-46

DOI: 10.1145/3820167 ↗

Kurz gefasst

Fachartikel in der Zeitschrift ACM Transactions on Software Engineering and Methodology, online erschienen am 04.11.2026. Verfasst von Yuwei Zhao und 4 weiteren Autor:innen. Die Arbeit wurde bisher 3-mal zitiert (Crossref) und nennt 66 Literaturangaben. Der Volltext ist frei zugänglich (Open Access, CC BY 4.0).

AbstractBibliografische AngabenZitierenVerwandte Studien

Abstract (Originalsprache)

Automated code optimization improves program performance through refactoring, and recent studies leverage LLMs for this purpose. Existing approaches mine optimization commits from open source codebases to build large-scale knowledge bases, then employ retrieval techniques such as BM25 to obtain relevant examples for hotspot code, guiding LLMs in optimization. However, semantically equivalent optimizations often appear in syntactically dissimilar code, so current retrieval methods fail to identify pertinent examples, leading to suboptimal results. To address these limitations, we propose SemOpt, a framework that leverages static program analysis to identify code segments, retrieve optimization strategies, and generate optimized results. SemOpt has three LLM-powered components: (1) a strategy library builder that extracts and clusters strategies from code modifications, (2) a rule generator that produces Semgrep static analysis rules to capture each strategy’s applicability, and (3) an optimizer that generates optimized code using the strategy library. On a benchmark of 151 C/C++ and 150 Python optimization tasks, SemOpt shows consistent improvements across different LLMs, increasing successful optimizations by 1.38–28 times on C/C++ and 4.60–6.33 times on Python versus the baseline. On large-scale projects, SemOpt improves performance metrics by 5.04%–218.07% on C/C++ and 61.77%–479.90% on Python, showing cross-language generalization and practical effectiveness.

Zitieren

APA

Zhao, Y., Xiao, Y., Xiao, Q., Zhang, Z., & Xiong, Y. (2026). SemOpt: LLM-Driven Code Optimization via Rule-Based Analysis. ACM Transactions on Software Engineering and Methodology, 35(11), 1-46. https://doi.org/10.1145/3820167

Vancouver

Zhao Y, Xiao Y, Xiao Q, Zhang Z, Xiong Y. SemOpt: LLM-Driven Code Optimization via Rule-Based Analysis. ACM Transactions on Software Engineering and Methodology. 2026;35(11):1-46. doi:10.1145/3820167

BibTeX
@article{Zhao2026,
  author = {Zhao, Yuwei and Xiao, Yuan-An and Xiao, Qianyu and Zhang, Zhao and Xiong, Yingfei},
  title = {SemOpt: LLM-Driven Code Optimization via Rule-Based Analysis},
  journal = {ACM Transactions on Software Engineering and Methodology},
  year = {2026},
  volume = {35},
  number = {11},
  pages = {1--46},
  doi = {10.1145/3820167}
}
Kostenlos starten →