Where Does the Performance Go? Understanding and Recovering Performance Regressions in C-to-Rust Translation
Zhiqiang Yuan, Chong Wang, Zhenhao Zhou, Junwei Liu, Xin Peng
Abstract
Rust is increasingly adopted as a memory-safe successor to C, and transpilers such as can migrate entire C projects while preserving their behavior. Preserving behavior, however, does not guarantee preserving performance. We study this gap on 20 real-world C projects and their translations. On the eight projects used for analysis, the translated Rust is more than 3\% slower than the original C on 12 of 19 operations, by up to 62.2\%. By comparing execution-cost profiles, optimized LLVM IR, and compiler optimization remarks across each C--Rust pair, we trace these slowdowns to nine recurring performance issues, spanning residual runtime work, missed compiler optimizations, and C-style source patterns, and derive an optimization direction for each. We then present , an LLM-based approach that encodes these issues as reusable optimization rules to recover the performance of translated Rust. profiles each project to locate hot functions and matches them against rule-specific patterns. The LLM then checks each rule's rewrite preconditions against the project context before rewriting, and a rewrite is kept only if it passes both functional and performance validation. On 41 operations from twelve held-out projects, preserves C outputs on all tested workloads and speeds up 40 operations over the translations, 18 of which end up faster than the original C. It outperforms the general-purpose coding agent on 31 of the 37 operations where both preserve C outputs, and outperforms its own variant without rule guidance on 34 of the 41 operations.
Create a lesson
Metadata
- Categories
- cs.AI, cs.PL
Related papers
MVAgent: Per-Video Agents under Global Coordination for Multi-Video Understanding
Shared title terminologycs.AIKewei Wei, XueXiang Wen, Bocheng Hu et al.
ESM-Bench: A Benchmark for Evaluating Whether AI Agents Understand Earth System Model Physics and Code
Shared title terminologycs.AIKoutian Wu, Yuxuan Cao, Gengchen Mai et al.
When Are Images Needed in Multimodal Machine Translation? Text-Only Routing for On-Demand Visual Context
Shared title terminologycs.AIXinyu Wang, Yingfeng Luo, Yuxin Gao et al.
Comparative Performance of Machine Learning Architectures for Fault Detection and Diagnosis in Chemical Processes
Shared title terminologycs.AIRayane Ammar Khodja, Alexandre Voisin, Victor Costa et al.
Efficient Natural Language to Temporal Logic Translation for Real-Time Physical AI
Shared title terminologycs.AIOliver Schön, Adrien Banse, John Lygeros et al.
Beyond Linear Decodability: Understanding and Improving Instruction Following in World Action Models
Shared title terminologycs.AIBokai Ji, Jiapeng Chen, Yi Zhang et al.