AI
New Benchmark Reveals How Far AI Falls Short at Real-World Code Optimization
Researchers introduce SWE-Perf to test whether language models can match human expertise in speeding up production software.
Researchers have created the first systematic benchmark to measure how well large language models can optimize code performance in real-world repositories, exposing substantial gaps between AI capabilities and expert-level engineering.
The Challenge of Performance Optimization#
Code performance optimization is a critical task in professional software development, yet the ability of LLMs to handle this work remains largely uncharted. While recent models have proven adept at generating code from scratch and fixing bugs, pushing that capability into the nuanced domain of making existing code faster and more efficient hasn't been thoroughly tested at scale.
Introducing SWE-Perf#
The benchmark, called SWE-Perf, consists of 140 carefully selected test cases, each drawn from actual performance-improving pull requests submitted to well-known GitHub repositories. Every instance in the benchmark is furnished with:
- The complete relevant codebase
- Target functions requiring optimization
- Performance-focused test suites
- Expert-crafted optimization patches
- Live environments for execution and validation
This construction ensures that the benchmark reflects genuine engineering challenges rather than artificial problem statements.
Testing Current AI Methods#
The research team evaluated multiple established approaches, including both file-level and repository-level strategies such as Agentless and OpenHands. The results painted a clear picture: today's leading language models struggle considerably when compared to the optimization solutions crafted by experienced developers, revealing a meaningful performance capability gap.
Why It Matters#
The findings underscore an important frontier for AI-assisted software engineering. As performance demands grow in production systems, the ability to automatically identify and implement code optimizations could deliver substantial value—but only if models can close the gap that this benchmark has now documented.

