PerfCodeBench: Benchmarking LLMs for System-Level High-Performance Code Optimization

Huihao Jing, Wenbin Hu, Shaojin Chen, Haochen Shi, Hanyu Yang, Sirui Zhang, Haoran Li, Yangqiu SongarXiv 2026

TL;DR

PerfCodeBench is a new large-scale executable benchmark designed to evaluate how well Large Language Models (LLMs) can optimize system-level code for performance. The study reveals a significant "efficiency gap": while modern models like GPT-5 and Claude 4.5 are increasingly reliable at writing correct code, they struggle to match human-expert implementations, particularly in hardware-sensitive domains like GPU programming and parallel computing.

What Problem Does This Paper Address?

Most existing LLM coding benchmarks (like HumanEval or MBPP) focus on functional correctness—does the code pass the unit tests? Others, like SWE-bench, look at repository-level software engineering. However, in systems programming, "correct" is only half the battle. High-performance software requires careful management of cache locality, data movement, synchronization costs, and hardware utilization.

The authors argue that there is a critical evaluation gap: we don't know if LLMs can actually perform system-level optimization. Existing efficiency benchmarks often focus on algorithmic complexity (e.g., $O(n \log n)$ vs $O(n^2)$), but real-world performance often hinges on low-level implementation choices that don't change the asymptotic complexity but drastically change the runtime.

Table 1: Comparison of PerfCodeBench with existing benchmarks, highlighting its unique focus on system-level efficiency and multi-language support.

Methods

The authors developed PerfCodeBench, an executable framework consisting of 1,854 tasks. Each task includes:

  1. A Baseline: A functionally correct but unoptimized implementation.
  2. A Reference: A human-expert optimized version.
  3. A Correctness Oracle: Deterministic tests to ensure the semantics remain unchanged.
  4. An Executable Harness: A stable environment to measure median latency.

To handle the high cost of executing thousands of benchmarks, they implemented a Scalable Evaluation Pipeline featuring:

  • Caching and Reuse: Compiled binaries and baseline results are cached across model runs.
  • Split-Pool Scheduling: CPU and GPU tasks are separated into different execution pools to prevent resource contention and handle the specific needs of nvcc (CUDA) compilation.
  • Two-Stage Evaluation: A fast "screening pass" filters out incorrect code before running more expensive, repeated benchmarks on promising candidates.

Datasets

PerfCodeBench draws from a diverse pool of real-world systems sources, including high-performance libraries like simdjson, CUTLASS, RocksDB, and Zstandard.

Figure 1: Distribution of executable tasks in PerfCodeBench across programming languages and task subdomains.

The benchmark covers six programming languages: C, C++, Go, Java, Python, and CUDA. The tasks span subdomains like SIMD kernels, AI inference runtimes, data processing, and parallel numeric HPC.

Key Insights and Ideas

  • Correctness and Efficiency are Decoupled: A model’s ability to generate runnable code (Correct-and-Runnable Rate, CRR) does not always correlate with its ability to reach expert-level speed. For instance, GPT-5.4 is the most "reliable" (highest CRR), but GPT-5 is better at closing the performance gap (highest Relative Efficiency).
  • The "CUDA Wall": There is a massive performance drop-off when moving from CPU to GPU tasks. Models that excel at C++ often fail completely at CUDA, struggling with parallel decomposition and memory hierarchy management.
  • Scaling Favors Efficiency: The authors found that as models scale (e.g., moving from Sonnet to Opus or GPT-5.4 to GPT-5), they tend to improve more on efficiency metrics than on basic correctness. This suggests that "performance intuition" may be a higher-order capability that emerges with larger models.
  • Rare but Strong Successes: Some models (like Kimi K2.6 or Qwen3.6-27B) have very low success rates but produce extremely high-quality, expert-level code when they do succeed. This suggests these models are "unstable" rather than "incapable."

Key Results

The evaluation of state-of-the-art models (SOTA) shows that human experts are still firmly in the lead for systems optimization.

Table 2: Overall results showing GPT-5 and GPT-5.4 as the top performers, though even they fall short of expert references in many tasks.
  • Top Performers: GPT-5 achieved the highest RBR (Reference-or-Better Rate) at 61.60%, meaning it matched or beat the expert in a majority of tasks it could solve. GPT-5.4 led in CRR (Correct-and-Runnable Rate) at 71.25%.
  • Language Sensitivity: Optimization ability is highly language-dependent. Python tasks had the highest average correctness (~85%), while CUDA was the most difficult by a huge margin, with an average CRR of only 10.53%.
Table 3: Performance breakdown by language. Note the stark contrast between CPU languages and CUDA.

Limitations and Future Work

The authors acknowledge several areas for improvement:

  • Environment Sensitivity: Results are tied to specific hardware and compiler versions; performance gains might shift in different environments.
  • Scope: The current benchmark focuses on local, single-node tasks. It does not yet cover distributed systems or long-horizon optimization workflows where an agent might need to profile code iteratively.
  • Ecological Fidelity: Some tasks are "benchmark-internal" constructions rather than direct lifts from production codebases, which might slightly reduce how well they represent real-world "in-the-wild" debugging.

Future work aims to expand into broader workloads, stronger references, and more diverse execution environments to further push LLMs toward producing truly efficient systems software.

Summary updated

Abstract

Large language models (LLMs) can often generate functionally correct code, but their ability to produce efficient implementations for performance-critical systems tasks remains limited. Existing code benchmarks mainly emphasize correctness or algorithmic problem solving, while realistic systems-level optimization is still underexplored. To address this gap, we introduce PerfCodeBench, an executable benchmark for evaluating LLMs on high-performance code optimization. The tasks require system-level implementation choices, hardware-aware optimization, and careful handling of performance bottlenecks. Each task includes executable correctness checks, a baseline implementation, and a reference optimized solution. This allows us to evaluate both correctness and runtime-oriented efficiency. Our evaluation on a broad set of state-of-the-art LLMs shows a clear gap between model-generated code and expert-optimized implementations. The gap is especially large on tasks involving parallelism and GPU operations. Current models also show weaknesses in cross-language robustness and in consistently reaching expert-level efficiency. These results suggest that performance-aware evaluation are still needed. LLMs should move beyond generating merely correct code toward producing efficient systems software. We submit the benchmark data, evaluation infrastructure, and complete logs of all LLMs-generated code at https://anonymous.4open.science/r/perfcodebench-7CDE.
BibTeX
@misc{jing2026perfcodebench,
  author = {Huihao Jing and Wenbin Hu and Shaojin Chen and Haochen Shi and Hanyu Yang and Sirui Zhang and Haoran Li and Yangqiu Song},
  title = {{PerfCodeBench: Benchmarking LLMs for System-Level High-Performance Code Optimization}},
  year = {2026},
  eprint = {2605.15222},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2605.15222},
}

Loading related content...

Figure