# Where Does the Performance Go? Understanding and Recovering Performance Regressions in C-to-Rust Translation

arXiv: https://arxiv.org/abs/2610.23044 · HTML: https://mlsanity.com/paper/2610.23044/

## Key facts

- No citing papers in the map yet (data through 24 Nov 2026).
- Builds on 24 of its 61 references that are in the map.
- Submitted 16 Oct 2026.

## Builds on (most cited first, 24 of 24)

- [Unsupervised Translation of Programming Languages](https://mlsanity.com/paper/2006.03511/) (2020)
- [RepairAgent: An Autonomous, LLM-Based Agent for Program Repair](https://mlsanity.com/paper/2403.17134/) (2024)
- [Exploring and Unleashing the Power of Large Language Models in Automated Code Translation](https://mlsanity.com/paper/2404.14646/) (2024)
- [Towards Translating Real-World Code with LLMs: A Study of Translating to Rust](https://mlsanity.com/paper/2405.11514/) (2024)
- [AlphaTrans: A Neuro-Symbolic Compositional Approach for Repository-Level Code Translation and Validation](https://mlsanity.com/paper/2410.24117/) (2024)
- [C2SaferRust: Transforming C Projects into Safer Rust with NeuroSymbolic Techniques](https://mlsanity.com/paper/2501.14257/) (2025)
- [Syzygy: Dual Code-Test C to (safe) Rust Translation using LLMs and Dynamic Analysis](https://mlsanity.com/paper/2412.14234/) (2024)
- [Enhancing Code Translation in Language Models with Few-Shot Learning via Retrieval-Augmented Generation](https://mlsanity.com/paper/2407.19619/) (2024)
- [Ownership guided C to Rust translation](https://mlsanity.com/paper/2303.10515/) (2023)
- [Scalable, Validated Code Translation of Entire Projects using Large Language Models](https://mlsanity.com/paper/2412.08035/) (2024)
- [RustMap: Towards Project-Scale C-to-Rust Migration via Program Analysis and LLM](https://mlsanity.com/paper/2503.17741/) (2025)
- [Translating C To Rust: Lessons from a User Study](https://mlsanity.com/paper/2411.14174/) (2024)
- [SafeTrans: LLM-assisted Transpilation from C to Rust](https://mlsanity.com/paper/2505.10708/) (2025)
- [To Tag, or Not to Tag: Translating C's Unions to Rust's Tagged Unions](https://mlsanity.com/paper/2408.11418/) (2024)
- [A Closer Look at the Security Risks in the Rust Ecosystem](https://mlsanity.com/paper/2308.15046/) (2023)
- [Raw Pointer Rewriting with LLMs for Translating C to Safer Rust](https://mlsanity.com/paper/2505.04852/) (2025)
- [Forcrat: Automatic I/O API Translation from C to Rust via Origin and Capability Analysis](https://mlsanity.com/paper/2506.01427/) (2025)
- [Project-Level C-to-Rust Translation via Pointer Knowledge Graphs](https://mlsanity.com/paper/2510.10956/) (2025)
- [RepoTransAgent: Multi-Agent LLM Framework for Repository-Aware Code Translation](https://mlsanity.com/paper/2508.17720/) (2025)
- [SemOpt: LLM-Driven Code Optimization via Rule-Based Analysis](https://mlsanity.com/paper/2510.16384/) (2025)
- [Code Quality Analysis of Translations from C to Rust](https://mlsanity.com/paper/2602.00840/) (2026)
- [How ISO C became unusable for operating systems development](https://mlsanity.com/paper/2201.07845/) (2022)
- [C2RUST-BENCH: A Minimized, Representative Dataset for C-to-Rust Transpilation Evaluation](https://mlsanity.com/paper/2504.15144/) (2025)
- [Multi-Source and Cross-Scenario Strategy-Guided Code Optimization](https://mlsanity.com/paper/2607.20353/) (2026)

## Abstract (arXiv)

Rust is increasingly adopted as a memory-safe successor to C, and transpilers such as crust 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 crust 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 ourtool, an LLM-based approach that encodes these issues as reusable optimization rules to recover the performance of translated Rust. ourtool 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, ourtool preserves C outputs on all tested workloads and speeds up 40 operations over the crust translations, 18 of which end up faster than the original C. It outperforms the general-purpose coding agent codex 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.
