Cross-Layer Characterization and AI-Assisted Diagnosis of C-to-Rust Performance
Migrating C code to Rust can significantly improve software security, but understanding the performance implications of such migrations remains challenging. While Rust is often claimed to match C’s performance, runtime safety checks, compiler optimizations, and hardware microarchitecture interact in ways that complicate performance diagnosis. We first conduct a systematic cross-layer characterization of 12 benchmarks comprising C implementations and their Rust counterparts. Our study reveals that runtime safety checks do not necessarily dominate performance overhead, as compiler and microarchitectural optimizations often mitigate their costs. Across 8 of the 12 benchmarks, at least one Rust implementation performs within 10% of its C counterpart or outperforms it. Motivated by these findings, we introduce FerroScope, an AI-assisted performance debugger that integrates source-level analysis, compiler optimization remarks, dynamic instruction traces, and hardware performance counters to diagnose performance differences between C and Rust. FerroScope reproduces our manual findings while providing more precise explanations in several cases, including identifying compiler optimizations inhibited by redundant bounds checks. Guided by these diagnoses, we develop an LLVM compiler pass that hoists redundant bounds checks through guarded loop versioning while preserving Rust’s panic behavior. The pass enables downstream compiler optimizations, including loop unrolling and conditional-move conversion, reducing Selection Sort’s overhead from 2.95×\times to 1.00×\times and improving Merge Sort from 1.43×\times to 0.91×\times relative to C. Together, our results demonstrate how cross-layer performance characterization and AI-assisted diagnosis can guide safety-preserving compiler optimizations for efficient C-to-Rust migration.
1. Introduction
Rust (, 2025) is a memory-safe, systems programming language that is increasingly gaining popularity. Unlike other memory-safe programming languages such as Java (, 2024) and Go (The Go Team, 2023), Rust does not rely on garbage collection (, 2025) to ensure temporal safety. Instead, the Rust compiler ensures that the Rust code is free from temporal safety vulnerabilities at compile-time. Performing these checks at compile time allows Rust to mitigate the performance overhead typically associated with temporal memory safety. Due to Rust’s memory safety and performance characteristics, system software such as operating systems (Tock Project, 2024; Narayanan et al., 2020; Redox OS Project, 2024; Boos et al., 2020) and device drivers (Crates.io, 2023; Corbet, 2022) are being increasingly written in Rust. Recently, the Linux kernel has officially added support for Rust code (Purdy, 2025; 79; Wallen, 2022). Similarly, parts of web browsers (, 2025) and web servers (Developers, 2007) are being rewritten in Rust.
However, not all of Rust’s safety checks happen at compile time. To guarantee spatial safety, Rust abstractions, such as vectors and strings, perform runtime checks to detect out-of-bounds memory accesses. Rust also supports run-time-checked pointers, including reference-counted pointers (RC), and types that support interior mutability safely (RefCells). The performance overhead for the runtime safety checks in Safe Rust code stems from many sources—some obvious, and some not so obvious. The obvious source of performance overhead is the cost of executing the additional machine instructions for the check itself. But there exist other non-obvious overhead sources, too. For example, inserting the runtime checks can potentially disrupt compiler optimizations. Bounds checks are essentially assembly-level branch instructions and inserting these branches can change how the compiler optimizes the surrounding code. Furthermore, not all of Rust’s language features impeded compiler optimization. Rust’s ownership model can also improve compiler optimizations in ways that partially offset these costs. The borrow checker’s guarantee that no mutable reference coexists with any other reference to the same memory allows the compiler to enable more aggressive alias analysis and optimization (Villani et al., 2025).
Rust’s safety checks also impact the hardware microarchitectural characteristics. The increase in the number of branch instructions resulting from the memory safety checks can put pressure on the hardware branch predictor. This could potentially increase the percentage of branch misses and stall the CPU pipeline, increasing the runtime overhead. However, on the other hand, if Rust’s memory-safety checks result in predictable branch outcomes and branch targets, then the hardware branch predictor can mitigate much of the associated overhead. Similarly, if the memory safety checks require loading the object’s bounds information from the DRAM, the performance overhead would be masked if hardware caches can capture this bounds information, thus reducing the data access latency.
These factors complicate the estimation of the performance of C code migrated to Rust. This presents a challenge for software developers who are considering rewriting their legacy C codebases to Rust. While it is clear that Rust would outperform other garbage-collected languages, there is less consensus surrounding its performance in comparison to C code. Performance results for Rust ports remain nuanced and vary by project. For instance, while the Rust implementation of zlib (de Vries, 2025) reportedly outperforms its C baseline, the Rust port of GNU CoreUtils (Rudra, ) initially underperformed. Only after subsequent targeted optimizations, core utilities such as wc, and ls match or exceed the performance of their original C counterparts (Larabel, 2025). This lack of consensus also prevails in research works measuring C and Rust performance. Some previous works (Cui, 2024; Zhang et al., 2022) have found that the memory-safety checks contribute to significant overheads, reaching up to 2.49×\times overhead. On the other hand, other works (Popescu et al., 2021) have found that Rust code can outperform C code for some libraries. More recent comparisons (Mihajlovic, 2025; Wells, 2026) show that well-optimized Rust implementations typically stay within 5–10% of C/C++ performance on average, with wins in some workloads and small losses in others. However, the reasons for this behavior have not yet been analyzed systematically, and we aim to fill this gap. Confounding matters further, different rewriting strategies can have different performance characteristics—from line-by-line C-to-Rust rewrites to a complete redesign and re-implementation of the program functionalities in Rust.
We introduce a framework for characterizing and diagnosing performance differences between C and migrated Rust code. Using this framework we demonstrate how the resulting workload characterization can guide compiler optimizations. Our work proceeds from a systematic characterization of C-to-Rust performance to an AI-assisted performance debugger, and finally to a compiler optimization informed by the identified performance bottlenecks.
Cross-Layer Performance Characterization Study. We first perform a systematic characterization of manually translated Rust code that decomposes language-level safety costs into compiler and microarchitectural factors. Our study includes 12 micro- and macro-benchmarks, comprising original C implementations and their manual Rust translations. Where applicable, we evaluate alternate Rust implementations to investigate the impact of implementation strategies on runtime performance. The microbenchmarks include searching and sorting algorithms that operate on dynamically sized buffers and incur frequent runtime bounds checks. The macrobenchmarks include Skip List (Vadrevu et al., 2024) and PageRank (Page et al., 1999) implementations, and the LibCsv (51) and u8c (Dentato, 2025) libraries.
Our characterization reveals that, contrary to common belief, Rust’s safety mechanisms do not always dominate runtime overheads. Instead, compiler and microarchitectural optimizations often hide these costs. Across 8 of the 12 evaluated benchmarks, at least one Rust implementation achieved performance within a 10% margin of the corresponding C baseline or exceeded it. Our analysis reveals a three-tier interaction between language-level safety mechanisms, compiler optimizations, and hardware microarchitecture, demonstrating that performance differences cannot be attributed solely to runtime safety checks. We further observe that differences in compiler optimizations between C and Rust can introduce unexpected slowdowns. These findings demonstrate that understanding performance regressions in C-to-Rust migration requires reasoning across multiple abstraction layers, from language-level constructs to compiler-generated instructions and their interactions with hardware microarchitecture.
AI-assisted Performance Debugger. Motivated by the complexity of these cross-layer interactions, we develop FerroScope—an AI-Assisted cross-layer performance debugger. FerroScope uses a multi-stage diagnostic pipeline that combines source-level analysis, LLVM intermediate representations (LLVM Project, ), compiler optimization remarks (LLVM Project, ), dynamic instruction traces, and hardware performance counters (53). By correlating evidence across these layers, FerroScope identifies potential causes of performance differences and produces evidence-supported explanations. We evaluate FerroScope against our manual characterization and find that it reproduces all of the manually established explanations while sharpening the diagnosis in many cases. For example, FerroScope leverages the compiler optimization remarks and identifies compiler optimizations inhibited by redundant bounds checks, as well as, distinguishes implementation-level overhead from micro-architectural effects.
Diagnosis-Guided Compiler Optimization. We further demonstrate how the performance debugging results can be used to inform compiler optimizations. We focus on the rustc compiler’s treatment of the runtime spatial safety checks. We observed that performing these safety checks inside hot loops was expensive and also that, while in many cases it was theoretically possible to hoist these checks to the loop preheader, the current compiler passes are unable to do so. We develop an LLVM (, 2020) compiler pass that hoists provably redundant bounds checks out of loops through guarded loop versioning. The pass preserves Rust’s observable panic behavior by retaining the original loop as a fallback when the preheader checks cannot establish safety. Removing redundant checks enables subsequent LLVM optimizations that were previously inhibited. Our evaluation shows that the pass reduces Selection Sort’s overhead from 2.95×\times to 1.00×\times, and improves Merge Sort from 1.43×\times to 0.91×\times relative to C.
2. Background
2.1. Rust Memory Safety
Compile-time Checks. Rust achieves memory safety through a combination of compile-time and runtime checks. Rust enforces a strict ownership system at compile time, encompassing three core concepts, namely ownership, lifetime, and borrowing. In Rust, every object has a single owner, and when that owner goes out of scope, the object is automatically dropped and its memory freed. References can borrow an object’s value, but the compiler ensures these references never outlive the owner. Additionally, the Rust Borrow Checker also enforces the Mutability-xor-aliasing rule, which ensures that heap variables can have either multiple immutable references or a single mutable reference, but never both simultaneously. Together, these rules provide strong temporal safety guarantees against Use-After-Free and Double-Free bugs, and prevent data races.
Runtime Checks. Rust enforces spatial safety through runtime bounds checking. Every time a vector or slice element is accessed by index, Rust inserts a check to verify that this index is within the object range. These checks eliminate spatial safety bugs but can incur some performance overhead. Consider the simplified memory safety check for a slice indexing operation shown in Figure 1. The index operation is performed by the core::slice::index::SliceIndex<[T]>::index function, in the Rust standard library. As the assembly instructions show, this check involves (i) loading the slice’s size into the rdi register, (ii) performing a test operation, and finally (iii) performing a conditional branch operation using the jne instruction. As we will discuss next, these instructions interact with compiler and microarchitectural optimizations, thus impacting runtime performance.
RefCell<T> performs borrow checking at runtime by tracking active borrows, instead of enforcing Rust’s borrowing rules at compile time. This allows the programmer to explicitly call the borrow_mut() or borrow() functions to borrow the interior value. Attempting to obtain a mutable borrow while any other borrow is active causes a panic. Rust also provides reference-counted pointers through Rc<T>, which enable shared ownership when compile-time ownership rules are too restrictive. The strong reference count of an Rc is incremented and decremented by clone() and drop(), respectively. The underlying value is dropped when the strong reference count reaches zero, while the allocation is retained until the weak reference count also reaches zero. Rc<T> and RefCell<T> are commonly used to implement shared mutable data structures, such as graphs and linked lists.
2.2. Compiler Toolchains and Optimizations
The Rust compiler (rustc) uses a multi-stage compilation pipeline, which lowers the Rust code to assembly code. Both rustc and clang use the same LLVM backend for low-level optimizations. Thus, a significant part of the code generation is similar across Rust and C.
Multiple compiler optimizations can impact the runtime performance of Rust’s safety checks. For example, for the slice index check code provided in Figure 1, one of the simplest compiler optimizations is to inline the index function. In cases where the code contains multiple index operations into the same slice, the compiler might optimize loading the slice size from memory by promoting the bounds value to a register and retaining it between subsequent accesses, thus amortizing the slow memory access. And finally, the compiler can choose to rewrite the two-instruction sequence of the conditional branch (jne) followed by the memory load (mov rax, [panic_bounds_check]) into a single conditional memory load (cmov) instruction, thus reducing the instruction count. We discuss potential impacts of this optimization in §6.2.
2.3. Microarchitectural Optimizations
Compilers optimize binaries to exploit microarchitectural structures such as caches, branch predictors, TLBs, and hardware prefetchers. However, language-level safety guarantees can disrupt the application of such optimizations. Specifically, the additional memory loads introduced by safety checks (e.g., bounds checks in Figure 1) can be absorbed if they hit in the L1 or L2 data caches, but can result in performance penalties if they evict frequently accessed data or increase instruction cache pressure. Similarly, highly predictable conditional branches in bounds checks allow the hardware branch predictor to absorb their cost. Hardware prefetchers and TLBs further mitigate latency by anticipating future accesses and caching virtual-to-physical translations (Gao et al., 2024; Ryoo et al., 2017), respectively, though mispredictions or cache thrashing can negate these benefits.
3. Characterization Methodology and Setup
3.1. Benchmarks
Our characterization consists of eight microbenchmarks and four application- and library-level macrobenchmarks. Our benchmark selection is motivated by three goals: (1) using workloads commonly found in systems-level code or prior C-to-Rust transpilation studies (Emre et al., 2021; Nitin et al., 2025; Zhang et al., 2023; Zhang et al., 2022), (2) covering diverse memory access patterns (regular, semi-regular, and irregular), and (3) stress-testing Rust’s runtime safety checks.
Microbenchmarks. Our microbenchmarks include sorting, searching, graph traversal, and matrix multiplication algorithms with diverse access patterns (, –; Landley, 2007; , 2020; , 2018; Contributors, ; contributors, 2007; , 2024; Chetlur et al., 2014; Uber AI × Uber Maps, 2022; Beamer et al., 2015; Shun and Blelloch, 2013). Breadth-First Search (BFS) and Depth-First Search (DFS) operate on adjacency matrices with 30,000 nodes, while Single-Source Shortest Path (SSSP) uses an adjacency-list representation with 30,000 nodes. Binary Search operates on a sorted array of 20 million integers, while Merge Sort and Quicksort each process arrays of 100 million integers. Selection Sort uses 200,000 integers, and Matrix Multiplication operates on two-dimensional integer matrices of size 2000×20002000\times 2000.
Application Benchmarks. To evaluate irregular, pointer-chasing access patterns, we include Skip List (Google, ; Redis, 2019; Vadrevu et al., 2024; Team, ) and PageRank (Page et al., 1999; Beamer et al., 2015; Shun and Blelloch, 2013). These represent linked and graph structures commonly used in systems such as LevelDB and Redis. The Skip List benchmark operates on a linked-node structure with N=5N=5 million nodes, performing 3N/23N/2 insert operations (including N/2N/2 updates), 3N/43N/4 removals, and NN searches, with both successful and unsuccessful lookups. We evaluate PageRank on the LiveJournal social network graph (Backstrom et al., 2006; Leskovec et al., 2009), which contains approximately 4 million nodes and 35 million edges, represented using adjacency lists.
Library Benchmarks. For control-intensive workloads with regular streaming access patterns, we use two libraries. U8C (Dentato, 2025) is a UTF-8 library used in Rust crates such as serde (serde-rs, ) and ripgrep (BurntSushi, ). We benchmark its u8next decoder, a DFA-based state machine with multiple branches and state transitions, on a text file containing approximately 2.8 million characters (Consortium, 2025). LibCSV (Gamble, ) is an ANSI-C CSV parsing library. We benchmark its csv_parse function, a single-pass, byte-oriented state machine with branch-heavy control flow, using the COVID-19 Open Research Dataset (Allen Institute for AI, 2020; Wang et al., 2020), containing approximately 1 million rows (1.65 GB).
3.2. Evaluation Methodology
As discussed in §2.2 and §2.3, the microarchitectural characteristics of a workload depend on the program-level data access patterns and also how the compiler optimizes the program. To analyze the workload’s microarchitectural characteristics, FerroScope uses Pin tools (, 2020) to record the dynamic instruction composition and the Hardware Performance Counters (53), discussed in §2.3, to record the microarchitectural characteristics of the workload. In particular, FerroScope records L1 and L2 data cache misses to analyze (i) the cache locality of memory safety metadata and (ii) changes in memory access optimizations caused by Rust’s abstractions and safety checks. It also records hardware branch predictor misses to identify overhead from unpredictable safety-check branches or increased branch predictor pressure. Finally, FerroScope uses a Pin tool (, 2020) to collect the dynamic instruction mix, focusing on memory loads, stores, and conditional branches that can potentially stall the CPU pipeline.
3.3. Evaluation Setup
Hardware Details. We conducted our experiments on the CloudLab (Duplyakin et al., 2019) c6525-25g nodes in the Utah cluster for AMD and sm110p nodes in the Wisconsin cluster for Intel. Both systems used Linux v5.15.0-168-generic. The AMD node is a Dell PowerEdge C6525 server equipped with an AMD EPYC 7302P processor. The machine had 16 physical cores (32 threads with SMT) running at 3.0 GHz and a 155 W TDP. Each core has 32 KiB L1D and 32 KiB L1I caches, 512 KiB L2 cache, and 16 MiB L3 per CCX (128 MiB total). The Intel node is a Supermicro SuperServer 110P equipped with an Intel Xeon Silver 4314 processor (Ice Lake-SP, Sunny Cove microarchitecture) (Intel Corporation, 2021). The machine had 16 physical cores (32 threads with Hyper-Threading) with a 2.4 GHz base clock (3.4 GHz turbo) and a 135 W TDP. Each core has 48 KiB L1D and 32 KiB L1I caches, 1.25 MiB L2 cache, and a non-inclusive shared 24 MiB L3 cache (Esmer and others, 2020).
Compilers. All C benchmarks were compiled with the clang-21.1.8 compiler, and the Rust benchmarks were compiled using rustc-1.94.1. Both clang-21.1.8 and rustc-1.94.1 use the LLVM-21 backend to compile to x86_64 assembly code. This ensures that both the C and Rust benchmarks are optimized by the LLVM optimization pipeline. To isolate the impact of Rust’s memory safety checks, we use a modified version of Rust that disables memory-safety related runtime checks (Zhang et al., 2022), which we call the Rust– compiler. In particular, the following safety checks were disabled in this compiler version—bounds checking for arrays, vectors, slices, and string/byte slices, and integer overflow detection, which is disabled in the base Rust version as well. All other checks, such as reference counting, remain intact. All benchmarks were evaluated at the -O3 optimization mode, using Release Mode builds.
Perf and Pin tools. To characterize microarchitectural behavior, we use hardware performance counters (53; De Melo, 2010; The Linux man-pages project, 2025) to collect branch mispredictions, L1-D cache misses, and L2 cache misses and instruction-level instrumentation with Intel Pin (Luk et al., 2005; , 2020) to obtain dynamic traces of all executed branches, loads, and stores. We do not report L3 misses because the L3 cache is shared across cores and can be interrupted by OS activity (Fedorova et al., 2010). To the best of our knowledge per-process or per-core metrics are not provided by either vendor. We focus our analysis on cache and branch-related behavior, as they are the primary microarchitectural components that account for the performance differences observed between Rust and C.
AI Usage. The scripts that produce the plots in this paper were generated with Claude Code. All plotted data was collected from our own experiments using the tooling described above.
4. Performance Characterization Summary
4.1. Performance Across C and Rust
Figure 2shows the runtime overhead of the benchmarks for AMD and Intel machines, respectively. To minimize variance, all reported results are averaged across three independent runs. We observe that despite the Rust code performing additional memory-safety checks, for 8 out of 12 benchmarks, at least one implementation variant incurs less than 10% overhead over the C implementation, and 5 outperformed the C implementation on both architectures. Moreover, for Rust, the iterator-based Matrix Multiplication and Merge Sort implementations, the UTF-8 Decode (u8next) benchmark, the LibCsv, and the Skip List benchmarks outperformed their C counterparts. Even among the index-based implementations that use random access into vectors—a pattern that necessarily incurs bounds checks on every access—several benchmarks exhibit modest overhead. This demonstrates that bounds checks alone do not necessarily lead to significant performance degradation.
4.2. Safety Checks Impact.
We observe that runtime bounds checks contribute to performance overhead for several, but not all, benchmarks. By using the Rust– compiler, we isolate the effect of runtime checks on performance. Eliminating bounds checks substantially reduces overhead for Matrix Multiplication (from 1.86×\times to 1.67×\times on AMD, 1.71×\times to 1.40×\times on Intel), recursive Merge Sort with indexing (from 1.68×\times to 1.23×\times on AMD, 1.58×\times to 1.15×\times on Intel), and PageRank (from 1.40×\times to 1.24×\times on AMD, 1.43×\times to 1.20×\times on Intel), but does not account for all of it. However, for Selection Sort and iterative Merge Sort, bounds check elimination removes the overhead entirely. Selection Sort drops from 2.93×\times to 0.99×\times on AMD and from 1.57×\times to 0.83×\times on Intel, while iterative Merge Sort drops from 1.44×\times to 0.91×\times on AMD and from 1.43×\times to 0.94×\times on Intel. In both of these cases, performance matches or outperforms C. In contrast, bounds check elimination makes less than a 10% difference on BFS, DFS, and Binary Search, despite their presence (as suggested by the decrease in conditional branches ranging from 30% to 60% comparing to Rust–). In these cases, Rust’s performance overhead originates elsewhere. We investigate these overhead sources in §6.1.
Moreover, out of the total 18 benchmarks and variants in our dataset, even the Rust– version underperformed the baseline C version for 4 (AMD) and 5 (Intel) benchmarks, respectively. Out of these BFS and Binary Search exhibited more than 20% overhead than the C version. This shows that there exists overhead sources in addition to Rust’s runtime memory safety checks. Previous work by Zhang et al. (Zhang et al., 2022) attributed any remaining performance overhead after disabling the memory-safety checks to ASCII to UTF-8 conversion for string-based workloads. However, our Rust benchmarks do not perform any additional ASCII to UTF-8 conversion over the C baseline. As we will discuss in detail in §6.1 and §6.2, the additional overhead occurs due to a complex interplay between compiler optimizations and microarchitectural components. Thus, the performance of Rust is not just the cost of the safety checks over the C baseline runtime.
4.3. Implementation Strategy Impact
We observed that the implementation strategy played a significant role in the Rust overhead, and also that in terms of performance, no particular strategy consistently outperformed others.
The Merge Sort algorithm has two algorithmic variants—a top-down recursive (TDR), and a bottom-up iterative (BUI) variant. The top-down recursive (TDR) variant follows the classic divide-and-conquer approach, recursively splitting the array in half until reaching single-element subarrays, then merging upward. Each call to merge allocates and frees two temporary arrays for the left and right halves. The bottom-up iterative (BUI) variant instead uses a single pre-allocated temporary buffer and iteratively merges subarrays of increasing width (1, 2, 4, …), copying the full result back after each pass. Because the bottom-up variant skips making additional memory copies, one would expect that it outperforms the top-down variant. We indeed observe this effect, with the C top-down benchmark taking ∼\sim12 seconds to sort a 100-million sized integer array, while the bottom-up benchmark takes ∼\sim9.5 seconds on both AMD and Intel architectures. One might expect that the overhead of the Rust translations of both these algorithm variants would remain consistent. However, as shown in Figure 2, Rust has a 68% overhead for the top-down algorithm, but a 44% overhead for the bottom-up algorithm on the AMD, and 58% and 43%, for Intel, respectively. Thus, not only is the top-down variant slower for the baseline C, it has a higher overhead when transpiled to Rust. We discuss potential reasons for this behavior using microarchitectural metrics in §6.1.1.
Additionally, it is possible to implement the same algorithm in both imperative and functional programming styles. For example, the sort algorithms can be implemented in an imperative-style, using indexing operations into the vec objects, or using a more functional programming style, using iterators and map and fold operations. One might expect that because the iterator-based implementations do not involve runtime bounds checks, they would always outperform the indexing-based implementations. However, as shown in Figure 2 we observed that this was true only for Matrix Multiplication and Merge Sort, where the iterator-style implementations matched or improved the Rust runtime over C. For SSSP, the iterator and indexed implementations achieved nearly identical performance, with both outperforming the C implementation. In contrast, Quicksort suffered little indexing overhead, with performance comparable to C. This shows that despite programmer intuition, there is a lack of a definitive superior implementation strategy.
5. FerroScope: An AI-assisted Performance Debugging Framework
We developed FerroScope to harness the capabilities of AI to systematically identify and explain the root causes of performance differences between C programs and their Rust counterparts. As illustrated in Figure 3, FerroScope consists of three sequential phases which consume debugging and profiling information relevant to cross-layer performance analysis, including call-stack profiles (flamegraphs), compiler intermediate representations, optimization remarks, dynamic instruction traces, and hardware performance counters. The pipeline is triggered only when the Rust implementation’s execution time exceeds that of the corresponding C implementation by a configurable threshold (10% in our evaluation). Each phase investigates a distinct potential source of performance degradation, namely, programming idioms, compiler optimizations, or microarchitectural effects. Phases 1 and 2 produce a user-facing verdict describing whether the investigated factor contributes to the observed overhead, along with a confidence level (low, medium, or high) reflecting the strength of the supporting evidence. The final phase identifies the primary microarchitectural driver of the overhead. Each phase also generates hypotheses for subsequent phases to validate, supported by observations from its own inputs. These hypotheses are passed forward as diagnostic notes, allowing later phases to build on earlier findings without assuming their correctness. A subsequent phase must independently validate a hypothesis using its own evidence before incorporating it into its conclusions. Only these notes are propagated between phases; the verdicts, confidence levels, and summaries are collected into the final diagnostic report. We instantiate the pipeline with Claude Opus 5.5 in all three phases, although the pipeline itself is model-agnostic.
Phase 1: Programming Idioms. Motivated by our findings on the performance implications of programming idioms in §4.3, the first phase investigates whether differences in programming idioms or implementation strategies between C and Rust contribute to the observed performance degradation. It analyzes the source code of both implementations, their execution times, and call-stack profiles (flamegraphs) to identify potentially expensive Rust abstractions, unnecessary computations, or differences in algorithmic implementation. The phase reports a positive verdict only when an implementation-level difference in performance-relevant code plausibly explains a substantial portion of the observed overhead. It also identifies potential compiler-level consequences of these implementation choices for further investigation.
Phase 2: Compiler Optimizations. Phase 2 investigates whether differences in compiler-generated code contribute to the observed performance degradation. It analyzes the source code, LLVM intermediate representations, compiler optimization remarks, disassembly, and dynamic instruction counts collected using Pin tools. By comparing the C and Rust implementations across these representations, the phase identifies missed optimizations, redundant runtime checks, differences in instruction selection, and other code generation inefficiencies. A positive verdict is reported only when there is evidence of a concrete optimization opportunity or inefficiency in the generated code that is not required by the program’s semantics. The phase also generates hypotheses about the performance consequences of these differences for further microarchitectural analysis.
Phase 3: Microarchitectural Effects. The final phase investigates how the generated instructions interact with the underlying hardware to explain the observed runtime differences. It combines the disassembled assembly instructions, dynamic instruction statistics, and hardware performance counters, including branch mis-predictions and cache misses, to distinguish overhead arising from additional instructions, reduced instruction-level parallelism, memory behavior, and other microarchitectural effects. This phase identifies the primary driver of the performance difference and assigns a confidence level based on the available evidence. Its findings also help validate or refine hypotheses generated by the preceding phases.
Isolating Runtime Safety Costs. Where applicable, the pipeline additionally uses measurements from Rust–, a modified Rust compiler that disables selected runtime safety checks, to distinguish their costs from other performance effects. All three phases receive the Rust– execution time, while Phase 2 additionally receives its disassembly and optimization remarks, and Phase 3 receives its disassembly and hardware performance counters. Comparing standard Rust against Rust– helps identify whether the overhead originates from runtime checks themselves or from other compiler and microarchitectural effects.
6. Understanding Performance Differences
Table 1 shows the high-level summary of the analysis results. These results draw on our manual cross-layer analysis and are corroborated by FerroScope’s AI-assisted diagnosis. In several cases, FerroScope further refines these explanations by identifying additional contributing factors or specific compiler-level causes. §6.1 and §6.2 presents detailed results on how micro-architectural optimizations and compiler effects impact the translated Rust code’s performance. Table 2 and Table 3 show the dynamic instruction counts and performance counters of Rust and Rust– relative to C. We note the difference in dynamic instruction mix between the two architectures, which we explain in Appendix A.
| Benchmark | Variant | Overhead | Explanation | |
|---|---|---|---|---|
| AMD | Intel | |||
| Binary Search | index-based | ↑ \uparrow 26% | ↑ \uparrow 15% | LLVM lowers branches to CMOV s, serializing consecutive dependent loads. |
| Depth-First Search | index-based | ↑ \uparrow 5% | ↑ \uparrow 5% | Lower L1D and L2D misses offset the increase in memory and branch instructions. |
| Breadth-First Search | index-based | ↑ \uparrow 10% | ↑ \uparrow 23% | Lost alias information prevents hoisting row pointers, introducing dependent loads before unpredictable branches.* |
| Single-Source Shortest Path (SSSP) | index-based | ↓ \downarrow 44% | ↓ \downarrow 22% | C uses CMOV s and stores every min computation, while Rust only stores when an update is needed. |
| iterator | ↓ \downarrow 44% | ↓ \downarrow 23% | ||
| Selection Sort | index-based | ↑ \uparrow 193% | ↑ \uparrow 57% | A redundant bounds check prevents 4 × \times loop unrolling, substantially increasing instructions per element. AMD also suffers from poor instruction layout.* |
| Quicksort | index-based | ↑ \uparrow 2% | ↑ \uparrow 7% | High branch predictor accuracy mitigates increased bounds checks with help from matching or better cache performance. |
| Merge Sort | index-based (TDR) | ↑ \uparrow 68% | ↑ \uparrow 58% | Bounds checks prevent CMOV conversion, introducing unpredictable branches. Zero-initialized temporary buffers add allocation overhead.* |
| iterator | ↓ \downarrow 15% | ↓ \downarrow 34% | Eliminates bounds checks and unpredictable branches leading to fewer mispredictions. | |
| index-based (BUI) | ↑ \uparrow 44% | ↑ \uparrow 43% | Bounds checks with distinct panic locations prevent CMOV conversion, resulting in unpredictable branches. | |
| Matrix Multiplication | index-based | ↑ \uparrow 86% | ↑ \uparrow 71% | Lost alias information prevents loop-invariant loads and register accumulation, introducing repeated loads and a loop-carried dependency.* |
| iterator | ↓ \downarrow 5% | ↑ \uparrow 1% | Eliminated bounds checks leads to same performance as C. | |
| PageRank | index-based | ↑ \uparrow 40% | ↑ \uparrow 43% | Escaped variables prevent elimination of some redundant checks. Additional memory traffic from 8-byte indices is a possible contributor, but the remaining overhead is unexplained.* |
| UTF-8 Decode ( u8next ) | index-based | ↓ \downarrow 33% | ↓ \downarrow 48% | Cache misses nearly eliminated (Intel) or greatly reduced while retaining similar instruction count to C. |
| CSV Validation (LibCSV) | index-based | ↓ \downarrow 13% | ↓ \downarrow 4% | Decrease in instruction count and improved cache performance. |
| Skip List | index-based | avg. ↓ \downarrow 29.3% | avg. ↓ \downarrow 6% | Lower L1D and L2D misses outweighs increased dynamic memory instructions. High branch prediction accuracy mitigates additional conditional branches. |
6.1. Micro-architectural Optimizations Hiding Rust Overheads
| App. | Time | Rust | Rust– | |||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Rust | Rust– | IPC | Cycles | Total Inst. | Cond Br | Stores | Loads | Br Misses | L1D Misses | L2D Misses | IPC | Cycles | Inst. | Cond Br | Stores | Loads | Br Misses | L1D Misses | L2D Misses | |
| BFS | 1.23 × \times | 1.22 × \times | 1.40 × \times | 1.19 × \times | 1.67 × \times | 1.40 × \times | 2.73 × \times | 3.00 × \times | 1.00 × \times | 1.24 × \times | 0.81 × \times | 0.96 × \times | 1.22 × \times | 1.17 × \times | 1.00 × \times | 2.73 × \times | 2.33 × \times | 1.00 × \times | 1.17 × \times | 0.80 × \times |
| BSrch | 1.15 × \times | 1.13 × \times | 1.27 × \times | 1.16 × \times | 1.48 × \times | 1.04 × \times | 1.11 × \times | 1.02 × \times | 0.06 × \times | 0.35 × \times | 0.28 × \times | 1.20 × \times | 1.13 × \times | 1.35 × \times | 0.74 × \times | 1.11 × \times | 1.02 × \times | 0.06 × \times | 0.35 × \times | 0.28 × \times |
| DFS | 1.05 × \times | 1.00 × \times | 1.41 × \times | 1.12 × \times | 1.57 × \times | 1.60 × \times | 1.43 × \times | 1.40 × \times | 0.99 × \times | 0.51 × \times | 0.76 × \times | 1.00 × \times | 1.00 × \times | 1.00 × \times | 1.00 × \times | 1.29 × \times | 1.00 × \times | 0.99 × \times | 0.52 × \times | 0.92 × \times |
| MM | 1.71 × \times | 1.40 × \times | 2.02 × \times | 1.60 × \times | 3.23 × \times | 9.97 × \times | 1.00 × \times | 3.00 × \times | 1.00 × \times | 1.07 × \times | 1.01 × \times | 0.91 × \times | 1.35 × \times | 1.23 × \times | 1.00 × \times | 1.00 × \times | 2.00 × \times | 1.00 × \times | 1.01 × \times | 1.01 × \times |
| MM-I | 1.01 × \times | 1.02 × \times | 0.99 × \times | 1.01 × \times | 1.00 × \times | 1.01 × \times | 0.67 × \times | 1.00 × \times | 1.00 × \times | 1.96 × \times | 1.53 × \times | 1.00 × \times | 1.00 × \times | 1.00 × \times | 1.00 × \times | 0.67 × \times | 1.00 × \times | 1.00 × \times | 2.13 × \times | 1.59 × \times |
| MS-TDR | 1.58 × \times | 1.15 × \times | 0.79 × \times | 1.49 × \times | 1.18 × \times | 2.13 × \times | 1.46 × \times | 1.26 × \times | 18.19 × \times | 1.07 × \times | 1.72 × \times | 1.11 × \times | 1.14 × \times | 1.26 × \times | 1.61 × \times | 1.76 × \times | 1.60 × \times | 0.98 × \times | 0.96 × \times | 0.80 × \times |
| MS-BUI | 1.43 × \times | 0.94 × \times | 0.66 × \times | 1.41 × \times | 0.93 × \times | 2.69 × \times | 1.10 × \times | 1.00 × \times | 20.99 × \times | 0.94 × \times | 1.46 × \times | 1.08 × \times | 0.92 × \times | 0.99 × \times | 0.98 × \times | 1.09 × \times | 1.46 × \times | 1.00 × \times | 0.95 × \times | 0.97 × \times |
| MS-I | 0.66 × \times | 0.65 × \times | 1.72 × \times | 0.63 × \times | 1.08 × \times | 1.53 × \times | 1.65 × \times | 1.34 × \times | 0.05 × \times | 0.97 × \times | 0.75 × \times | 1.68 × \times | 0.64 × \times | 1.08 × \times | 1.53 × \times | 1.65 × \times | 1.34 × \times | 0.05 × \times | 0.97 × \times | 0.76 × \times |
| QS | 1.07 × \times | 0.99 × \times | 1.21 × \times | 1.07 × \times | 1.29 × \times | 1.63 × \times | 1.04 × \times | 1.02 × \times | 1.03 × \times | 0.59 × \times | 0.87 × \times | 0.95 × \times | 0.99 × \times | 0.94 × \times | 1.01 × \times | 0.97 × \times | 0.98 × \times | 0.99 × \times | 1.23 × \times | 1.01 × \times |
| SelS | 1.57 × \times | 0.83 × \times | 1.36 × \times | 1.60 × \times | 2.18 × \times | 2.40 × \times | 1.00 × \times | 1.00 × \times | 1.00 × \times | 3.03 × \times | 2.97 × \times | 0.98 × \times | 0.84 × \times | 0.82 × \times | 1.00 × \times | 1.00 × \times | 1.00 × \times | 1.03 × \times | 2.82 × \times | 32.70 × \times |
| SSSP | 0.78 × \times | 0.77 × \times | 1.25 × \times | 0.75 × \times | 0.94 × \times | 2.50 × \times | 0.00 × \times | 1.00 × \times | 1758.61 × \times | 1.44 × \times | 2.25 × \times | 0.83 × \times | 0.75 × \times | 0.63 × \times | 1.25 × \times | 0.00 × \times | 1.00 × \times | 1767.93 × \times | 0.26 × \times | 3.26 × \times |
| SSSP-I | 0.77 × \times | 0.78 × \times | 1.24 × \times | 0.76 × \times | 0.94 × \times | 2.50 × \times | 0.00 × \times | 1.00 × \times | 1772.72 × \times | 1.44 × \times | 2.45 × \times | 0.91 × \times | 0.75 × \times | 0.69 × \times | 1.50 × \times | 0.00 × \times | 1.00 × \times | 1790.17 × \times | 1.50 × \times | 2.70 × \times |
| CSV-V | 0.96 × \times | 0.96 × \times | 0.78 × \times | 0.93 × \times | 0.73 × \times | 0.91 × \times | 0.66 × \times | 0.67 × \times | 0.78 × \times | 0.13 × \times | 0.34 × \times | 0.78 × \times | 0.93 × \times | 0.73 × \times | 0.91 × \times | 0.66 × \times | 0.67 × \times | 0.78 × \times | 0.19 × \times | 0.57 × \times |
| PR | 1.43 × \times | 1.20 × \times | 1.04 × \times | 1.45 × \times | 1.50 × \times | 2.11 × \times | 0.74 × \times | 2.01 × \times | 0.96 × \times | 1.06 × \times | 1.17 × \times | 0.80 × \times | 1.20 × \times | 0.96 × \times | 1.02 × \times | 1.03 × \times | 1.49 × \times | 0.97 × \times | 1.04 × \times | 1.11 × \times |
| SL-I | 0.96 × \times | 0.95 × \times | 2.66 × \times | 0.94 × \times | 2.51 × \times | 3.37 × \times | 3.80 × \times | 2.47 × \times | 0.99 × \times | 0.63 × \times | 0.76 × \times | 2.49 × \times | 0.93 × \times | 2.31 × \times | 2.86 × \times | 3.71 × \times | 2.14 × \times | 1.01 × \times | 0.64 × \times | 0.78 × \times |
| SL-R | 0.93 × \times | 0.93 × \times | 2.64 × \times | 0.93 × \times | 2.45 × \times | 3.51 × \times | 4.58 × \times | 2.06 × \times | 0.98 × \times | 0.63 × \times | 0.77 × \times | 2.40 × \times | 0.92 × \times | 2.21 × \times | 3.03 × \times | 4.42 × \times | 1.92 × \times | 0.99 × \times | 0.63 × \times | 0.77 × \times |
| SL-S | 0.93 × \times | 0.93 × \times | 1.98 × \times | 0.94 × \times | 1.86 × \times | 2.71 × \times | 6.92 × \times | 1.78 × \times | 1.00 × \times | 0.64 × \times | 0.79 × \times | 1.87 × \times | 0.92 × \times | 1.73 × \times | 2.35 × \times | 6.92 × \times | 1.64 × \times | 0.96 × \times | 0.65 × \times | 0.80 × \times |
| u8next | 0.52 × \times | 0.50 × \times | 2.14 × \times | 0.51 × \times | 1.09 × \times | 1.12 × \times | 1.00 × \times | 1.00 × \times | 1.20 × \times | 0.03 × \times | 0.00 × \times | 2.20 × \times | 0.50 × \times | 1.09 × \times | 1.12 × \times | 1.00 × \times | 1.00 × \times | 0.93 × \times | 0.03 × \times | 0.00 × \times |
| App. | Time | Rust | Rust– | |||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Rust | Rust– | IPC | Cycles | Total Inst. | Cond Br | Stores | Loads | Br Misses | L1D Misses | L2D Misses | IPC | Cycles | Inst. | Cond Br | Stores | Loads | Br Misses | L1D Misses | L2D Misses | |
| BFS | 1.10 × \times | 1.01 × \times | 1.37 × \times | 1.22 × \times | 1.67 × \times | 1.40 × \times | 2.51 × \times | 3.00 × \times | 1.00 × \times | 1.01 × \times | 1.01 × \times | 1.04 × \times | 1.12 × \times | 1.17 × \times | 1.00 × \times | 2.51 × \times | 2.33 × \times | 1.00 × \times | 1.02 × \times | 1.01 × \times |
| BSrch | 1.26 × \times | 1.25 × \times | 1.16 × \times | 1.27 × \times | 1.48 × \times | 1.04 × \times | 1.11 × \times | 1.02 × \times | 0.06 × \times | 0.27 × \times | 0.27 × \times | 1.07 × \times | 1.26 × \times | 1.35 × \times | 0.74 × \times | 1.11 × \times | 1.02 × \times | 0.06 × \times | 0.27 × \times | 0.27 × \times |
| DFS | 1.05 × \times | 0.97 × \times | 1.60 × \times | 0.98 × \times | 1.57 × \times | 1.60 × \times | 1.43 × \times | 1.40 × \times | 1.00 × \times | 0.63 × \times | 0.95 × \times | 1.03 × \times | 0.97 × \times | 1.00 × \times | 1.00 × \times | 1.29 × \times | 1.00 × \times | 1.00 × \times | 0.63 × \times | 0.97 × \times |
| MM | 1.86 × \times | 1.67 × \times | 1.75 × \times | 1.84 × \times | 3.23 × \times | 9.97 × \times | 1.00 × \times | 3.00 × \times | 1.00 × \times | 1.22 × \times | 1.20 × \times | 0.74 × \times | 1.66 × \times | 1.23 × \times | 1.00 × \times | 1.00 × \times | 2.00 × \times | 1.00 × \times | 1.21 × \times | 1.13 × \times |
| MM-I | 0.95 × \times | 0.95 × \times | 1.06 × \times | 0.95 × \times | 1.00 × \times | 1.01 × \times | 0.67 × \times | 1.00 × \times | 1.00 × \times | 1.01 × \times | 1.03 × \times | 1.06 × \times | 0.94 × \times | 1.00 × \times | 1.00 × \times | 0.67 × \times | 1.00 × \times | 1.00 × \times | 1.01 × \times | 1.03 × \times |
| MS-TDR | 1.68 × \times | 1.23 × \times | 0.70 × \times | 1.69 × \times | 1.18 × \times | 2.13 × \times | 1.23 × \times | 1.39 × \times | 18.60 × \times | 1.21 × \times | 1.16 × \times | 1.03 × \times | 1.23 × \times | 1.27 × \times | 1.62 × \times | 1.25 × \times | 1.56 × \times | 1.01 × \times | 1.17 × \times | 2.09 × \times |
| MS-BUI | 1.44 × \times | 0.91 × \times | 0.62 × \times | 1.51 × \times | 0.93 × \times | 2.69 × \times | 1.10 × \times | 1.00 × \times | 20.52 × \times | 1.00 × \times | 1.00 × \times | 1.13 × \times | 0.88 × \times | 0.99 × \times | 0.98 × \times | 1.09 × \times | 1.46 × \times | 1.00 × \times | 1.00 × \times | 0.95 × \times |
| MS-I | 0.85 × \times | 0.84 × \times | 1.36 × \times | 0.80 × \times | 1.09 × \times | 1.53 × \times | 1.12 × \times | 1.27 × \times | 0.09 × \times | 1.04 × \times | 2.02 × \times | 1.37 × \times | 0.79 × \times | 1.09 × \times | 1.53 × \times | 1.12 × \times | 1.27 × \times | 0.09 × \times | 1.04 × \times | 2.00 × \times |
| QS | 1.02 × \times | 0.96 × \times | 1.29 × \times | 1.00 × \times | 1.29 × \times | 1.63 × \times | 1.04 × \times | 1.02 × \times | 0.98 × \times | 1.00 × \times | 0.95 × \times | 0.98 × \times | 0.96 × \times | 0.94 × \times | 1.01 × \times | 0.97 × \times | 0.98 × \times | 0.99 × \times | 1.00 × \times | 1.00 × \times |
| SelS | 2.93 × \times | 0.99 × \times | 0.75 × \times | 2.90 × \times | 2.18 × \times | 2.40 × \times | 1.00 × \times | 1.00 × \times | 0.94 × \times | 1.00 × \times | 0.62 × \times | 0.82 × \times | 1.00 × \times | 0.82 × \times | 1.00 × \times | 1.00 × \times | 1.00 × \times | 0.99 × \times | 1.00 × \times | 1.01 × \times |
| SSSP | 0.56 × \times | 0.54 × \times | 1.70 × \times | 0.55 × \times | 0.94 × \times | 2.50 × \times | 0.00 × \times | 1.00 × \times | 152.74 × \times | 1.76 × \times | 2.00 × \times | 1.17 × \times | 0.53 × \times | 0.63 × \times | 1.25 × \times | 0.00 × \times | 1.00 × \times | 137.67 × \times | 1.82 × \times | 2.01 × \times |
| SSSP-I | 0.56 × \times | 0.54 × \times | 1.70 × \times | 0.55 × \times | 0.94 × \times | 2.50 × \times | 0.00 × \times | 1.00 × \times | 140.56 × \times | 1.76 × \times | 1.99 × \times | 1.28 × \times | 0.54 × \times | 0.69 × \times | 1.50 × \times | 0.00 × \times | 1.00 × \times | 289.83 × \times | 1.81 × \times | 1.97 × \times |
| CSV-V | 0.87 × \times | 0.92 × \times | 0.69 × \times | 1.06 × \times | 0.73 × \times | 0.91 × \times | 0.66 × \times | 0.67 × \times | 1.00 × \times | 0.08 × \times | 0.74 × \times | 0.76 × \times | 0.95 × \times | 0.73 × \times | 0.91 × \times | 0.66 × \times | 0.67 × \times | 1.00 × \times | 0.79 × \times | 0.65 × \times |
| PR | 1.40 × \times | 1.24 × \times | 1.07 × \times | 1.40 × \times | 1.50 × \times | 2.10 × \times | 1.05 × \times | 2.01 × \times | 1.00 × \times | 1.11 × \times | 1.05 × \times | 0.78 × \times | 1.24 × \times | 0.96 × \times | 1.02 × \times | 1.04 × \times | 1.49 × \times | 0.99 × \times | 1.10 × \times | 1.04 × \times |
| SL-I | 0.75 × \times | 0.73 × \times | 3.38 × \times | 0.74 × \times | 2.51 × \times | 3.37 × \times | 3.80 × \times | 2.46 × \times | 1.00 × \times | 0.72 × \times | 0.60 × \times | 3.18 × \times | 0.73 × \times | 2.31 × \times | 2.86 × \times | 3.71 × \times | 2.14 × \times | 1.00 × \times | 0.71 × \times | 0.62 × \times |
| SL-R | 0.69 × \times | 0.69 × \times | 3.70 × \times | 0.66 × \times | 2.45 × \times | 3.51 × \times | 4.58 × \times | 2.06 × \times | 0.98 × \times | 0.79 × \times | 0.53 × \times | 3.34 × \times | 0.66 × \times | 2.21 × \times | 3.03 × \times | 4.42 × \times | 1.92 × \times | 0.96 × \times | 0.79 × \times | 0.54 × \times |
| SL-S | 0.68 × \times | 0.68 × \times | 2.72 × \times | 0.68 × \times | 1.86 × \times | 2.71 × \times | 6.92 × \times | 1.78 × \times | 0.99 × \times | 0.64 × \times | 0.56 × \times | 2.54 × \times | 0.68 × \times | 1.73 × \times | 2.35 × \times | 6.92 × \times | 1.64 × \times | 0.98 × \times | 0.63 × \times | 0.56 × \times |
| u8next | 0.67 × \times | 0.76 × \times | 1.57 × \times | 0.70 × \times | 1.09 × \times | 1.12 × \times | 1.00 × \times | 1.00 × \times | 0.91 × \times | 0.79 × \times | 0.04 × \times | 1.43 × \times | 0.77 × \times | 1.09 × \times | 1.12 × \times | 1.00 × \times | 1.00 × \times | 0.86 × \times | 0.79 × \times | 0.04 × \times |
We now discuss the benchmark overheads using the microarchitectural characteristics and dynamic instruction traces. For all but 4 benchmarks, at least one Rust implementation had comparable (within 10%) performance or outperformed C. Benchmarks involving few bounds checks, such as graph traversals, are natural candidates for low overhead. Indeed, BFS incurs only 10% overhead on AMD (23% on Intel), and DFS only 5% on both architectures. However, we observe that surprisingly, even for some benchmarks that contain a high number of bounds checks in tight loops (SSSP, DFS, and Quicksort), the Rust overhead is less than 10%. Below, we discuss the microarchitectural components that hide Rust’s overheads (Table 3 and Table 2).
6.1.1. Impact of Branch Predictors
Indexing into a vec or a slice invokes a bounds-check consisting of three operations—i) loading the size of the vec or slice object, ii) comparing the index with the size, and finally iii) depending on the comparison result retrieving the element at the index or panicking. Thus, if the vector’s size is not promoted to a register by the Rust compiler and results in a long latency memory load operation to resolve the branch condition, it can stall the CPU pipeline. Therefore, any benchmark involving frequent bounds checks, such as random index-based sorting benchmarks, could be expected to incur a high overhead. Yet, across the 18 benchmarks and variants, branch predictor misses decreased or stayed within 10% of the baseline C version in most cases—14 of 18 on AMD and 13 of 18 on Intel, showing that the hardware branch predictor can typically accurately predict the branch targets of the bounds checks branches.
Cases where BPs Hide the Costs. We observe that for the DFS and Quicksort benchmarks, despite incurring a roughly 60% increase in conditional branches on both architectures, the number of branch misses remains within 3% of the C implementation or less. Both of these cases result in at most a 7% increase in runtime overhead overall. More impressively, the Skip List operations show a drastic increase in branch instructions, ranging from 2.71×\times for the Search operation to 3.51×\times for the Remove operation, but show an equal or better branch miss count to the C baseline. Combined with improved cache performance, discussed in §6.1.2, this results in an average 30% and 6% runtime improvement on AMD and Intel, respectively.
Iterators Elide Bounds Checks. Unlike index-based accesses, using iterators to traverse a vec or slice variable, does not involve bounds checks at all. Our results show that the use of iterators can generally aid in reducing bounds checking overhead. For example, the iterator-based Matrix Multiplication benchmark successfully removed nearly all bounds checks and saw only a 1% increase in the dynamic branch count over C and equal branch misses, resulting in a 5% runtime improvement for AMD and a small 1% decrease for Intel. A similar pattern holds for the iterator-based, top-down recursive Merge Sort implementation. While it incurs a modest increase in dynamic memory and branch instructions, it almost completely eliminates branch mispredictions to just 0.09×\times and 0.05×\times for AMD and Intel, respectively, compared to the C baseline. This is a striking difference compared to the ∼\sim18×\times increase in branch misses seen in the index-based Top-Down, Recursive variant. Combined with competitive cache performance, the iterator implementation ultimately outperforms C with runtime overheads of 0.85×\times for AMD and 0.66×\times for Intel. We note that compared to the baseline C version, the iterator-based Merge Sort variant increases the number of conditional checks to be performed. These checks stem from iterator semantics ensuring that the left, right, and output array iterators are still viable in the Merge function’s hot loop. In contrast, the C code only checks if the left and right array indices are still valid, resulting in 2 instead of 3 checks.
Cases Where BPs Cannot Hide the Costs. We observed that for benchmarks such as Merge Sort and SSSP, the Rust variants exhibit a significant increase in the number of executed branch instructions, resulting in an increased pressure on the branch predictors. Thus, the branch mispredictions are naturally higher for Rust than C. This is particularly evident in the Merge Sort benchmark. Both the top-down recursive (TDR) and bottom-up iterative (BUI) implementations exhibit a substantial increase in dynamic branch instructions for Rust over C: 2.13×\times for TDR and 2.69×\times for BUI on both architectures. This increase corresponds to a rise in branch mispredictions on both architectures, approximately 18×\times for the top-down recursive implementation and 20×\times for the bottom-up iterative implementation. We discuss the compiler behavior responsible for this in §6.2.
6.1.2. Impact of Data Caches
Across both architectures, the Rust implementations of Depth-First Search, SSSP, and Skip List ranges from 21–56% fewer L1D-cache misses compared to the C baseline. On the Intel machine specifically, Quicksort also follows this trend, while Binary Search, LibCsv, and UTF-8 Decode demonstrate even more significant reductions exceeding 50% (up to 97% for UTF-8 Decode). Conversely, on the AMD machine, Breadth-First Search, Quicksort, and Selection Sort also display L1D-cache behavior comparable to their C counterparts. In most cases, these cache-efficiency gains occur despite the Rust implementations issuing more memory instructions overall. This shows that even if the Rust code compiles to more memory operations, potentially due to memory-safety checks, the L1D-cache can capture these accesses, thus limiting their overhead.
To illustrate, the Rust translation of the Skip List search operation issues 1.78×\times more memory load operations and 6.92×\times more store operations than the C baseline. However, the L1D-cache misses decreases by 36%, and L2 misses by 44%, resulting in an effective 32% decrease in the runtime compared to the baseline C version on the AMD machine. A more modest but similar pattern is found on the Intel machine. Similarly, the Rust version of the Binary Search benchmark, which has only a 11% increase in the dynamic memory store instructions, has a 73% decrease in the L1D-cache miss rate on the AMD machine. The Single-Source Shortest Path benchmark was the only benchmark to exhibit a drastic decrease in dynamic memory instructions accompanied by a high increase in cache misses. For SSSP, the L1D-cache misses increase by 76% over the baseline C, but still result in a runtime improvement of 44% on AMD. The behaviors of both the Binary Search and SSSP benchmarks are further influenced by diverging compiler optimization effects, which we explore further in §6.2.
| Prefetches | L1D Cache Misses | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| C | Rust (vec) | Rust– (vec) | Rust (raw) | Rust– (raw) | C | Rust (vec) | Rust– (vec) | Rust (raw) | Rust– (raw) |
| 962.35 | 225.16 | 225.61 | 225.20 | 225.23 | 1802.42 | 478.99 | 479.06 | 479.00 | 479.24 |
Higher Number of Prefetches in C. To analyze the differing cache behavior between C and Rust, we conducted a series of experiments with the Binary Search benchmark. We first replaced the Rust vector with a raw pointer, which would ensure it would perform no bounds checks. As shown in the results in Table 4, both the vector-based and raw-pointer based implementations have significantly lower L1D-cache miss rates. The only difference we could find between the C and Rust versions was that the C code was making ∼\sim5×\times as many prefetch requests as the Rust baseline. By disassembling the binary, we confirmed that these were hardware prefetcher requests, and because we could not control the BIOS settings on the CloudLab machines, we could not turn it off to further isolate the behavior. Furthermore, the hardware performance counter records only the L1D-cache misses resulting from demand accesses and not prefetches. Therefore, we hypothesize that the higher number of prefetches in C code evicts hot data in the cache, resulting in a higher L1D-cache miss rate.
6.2. Compiler Optimization Impact
As previously noted by Popescu et al. (Popescu et al., 2021), the runtime safety checks can alter compiler optimizations in unpredictable ways. We discuss some of the interesting compiler optimization behaviors we observed during our analysis.
6.2.1. Promotion of Bounds Value to Registers
We observed that for the Index-based Quicksort and the Selection Sort algorithms, despite performing additional memory-safety checks, as evidenced by the increase in dynamic branch instructions, there is little increase in the memory load instructions, with a 2% increase for Quicksort and no change for Selection Sort. This indicates that the compiler could successfully promote the vector size to a register, reducing any latency related to memory accesses. However, we did not observe this behavior in any of the other benchmarks, indicating that either some of the bound values could not be promoted to registers, or the extra register pressure from the bounds values caused other frequently-accessed variables to be spilled to the stack.
| App. | C | Rust | Rust– |
|---|---|---|---|
| BFS | 9 | 60.0k | 60.0k |
| BSrch | 1 | 892.9M | 892.9M |
| DFS | 0 | 0 | 0 |
| MM | 0 | 0 | 0 |
| MM-I | 4.1k | 4.0M | 4.0M |
| MS-TDR | 2.53B | 1.02B | 2.94B |
| MS-BUI | 2.74B | 1.00B | 2.84B |
| App. | C | Rust | Rust– |
|---|---|---|---|
| MS-I | 2.53B | 3.17B | 3.17B |
| QS | 0 | 0 | 38.6M |
| QS-I | 0 | 125.0M | 125.0M |
| SelS | 0 | 0 | 0 |
| SSSP | 1.35B | 5 | 5 |
| SSSP-I | 1.35B | 4 | 4 |
| App. | C | Rust | Rust– |
|---|---|---|---|
| CSV-V | 12.4M | 20.1M | 20.1M |
| PR | 4 | 103 | 0 |
| SL-I | 15.0M | 37.5M | 37.5M |
| SL-R | 1 | 497 | 497 |
| SL-S | 0 | 5 | 5 |
| u8next | 0 | 0 | 0 |
6.2.2. Bounds Checks Preventing Loop Unrolling.
Popescu et.al (Popescu et al., 2021) hypothesized that Rust’s safety checks can inhibit other compiler optimizations. We found an evidence of that behavior for the Selection Sort benchmark. For both the original C and the Rust– versions, the LLVM compiler can successfully unroll the core loop 4×\times, thus reducing the branch instructions. However, the FerroScope debugger identified that this loop unrolling optimization was not successful in the Rust version. Using the LLVM compilers CRemark (LLVM Project, ) feature, the FerroScope debugger identified a provably redundant bounds check in the inner loop that searches for the minimum element. The loop compares arr[j] < arr[min_idx] and updates min_idx to j when the comparison holds. Since min_idx is always either the outer loop index i or some j < len, the bounds check can never fail. A simple check between possible values of min_idx (the ranges of i and j) and the length off arr[] would prove this check redundant. However, the Rust compiler does not eliminate it, introducing multiple panic exits within the loop. These panic exits ultimately prevent the 4×4\times loop unrolling optimization observed in both C and Rust–. Similarly, Rust’s bounds checks also prevents the CMOV optimization which we discuss in §6.2.3.
6.2.3. Converting Branch + Load Patterns to Conditional Moves
One possible compiler optimization is to turn conditional branch instructions followed by a memory operation—for example the CMP rdi, rdx; JNE .LBB19_1; MOV rax, ptr sequence shown in Figure 1, with a conditional move instruction, such as CMP rdi, rdx; CMOV rax, ptr;. The CMOV instruction performs a memory move operation if the previous condition evaluates to a certain value. This reduces the number of executed instructions and essentially converts a control dependency, in the form of the branch instruction, into a data dependency. Our results show this optimization has a mixed impact on performance. Table 5 shows how often this transformation occurs across the benchmarks.
Missed CMOV Optimization in Rust. For the index-based variants of the Merge Sort benchmark, the C compiler applies the conditional load patterns to CMOV promotion, which reduces the overall number of branches, and also the branch predictor misses (Table 2, Table 3). However, the Rust compiler failed to apply this optimization to the Rust code, resulting in a significantly higher number of mispredictions (∼\sim18×\times TDR, ∼\sim20.5×\times BUI). In Merge Sort (TDR), FerroScope identifies that the CMOV-conversion is being prevented by Rust’s bounds checks. In the Rust code, the bounds check on arr[k] is performed separately in each branch of the main merge loop’s comparison (left_arr[i] <= right_arr[j]). Each check has a call to panic which provides different Location information including line number and file. If a check fails, execution exits through its corresponding panic path. As a result, these two checks cannot be merged into one and hoisted. For Merge Sort (BUI), FerroScope’s Optimization Checker infers that the compiler’s CFG simplification pass is unable to hoist the common test or merge the two stores into a select because of this. Table 5 shows that in the case of both indexed (non-iterator) implementations of Merge Sort, compiling with Rust– enabled the same CMOV optimization that C used and made a significant improvement in performance, even surpassing C’s performance for the bottom up (iterative) implementation.
CMOV Misoptimization in Rust. The CMOV optimization does not always lead to improved performance. As discussed in §6.1.1, the hardware branch predictor is very efficient for predictable branch checks, so this conversion likely is inefficient and is, in fact, a mis-optimization for benchmarks such as Binary Search. Binary Search takes 1.26×\times C’s time in Rust, and removing runtime checks has no effect (1.25×\times in Rust–). Using the LLVM compiler’s CRemarks (LLVM Project, ) framework, the FerroScope debugger’s Optimizer Checker traced this overhead to the LLVM compiler’s Instruction Selection pass. The LLVM compiler’s x86-64 backend lowers the comparisons of mid with lo and hi with a branch in C but with CMOVs in Rust (Table 5). The CMOVs make the selection of the next midpoint, and therefore the next load operation, data-dependent on the current load, requiring so consecutive loads to be serialized. FerroScope’s μ\muarch Checker verified this with hardware counters. Rust has 0.06×\times C’s branch misses and 0.27×\times its cache misses, yet needs 1.27×\times the cycles (Table 3).
We disabled CMOV conversion with the flag -x86-cmov-converter-force-all=true for SSSP in C and Binary Search in Rust. We found that without CMOV, SSSP was able to reduce its runtime by 57%, outperforming the Rust implementation. Removing CMOVs for Binary Search in Rust reduced its overhead to only 7% overhead over C.
CMOV Misoptimization in C. The CMOV misoptimization, however, is not exclusive to Rust. In the SSSP benchmark, the C implementation is similarly misoptimized using CMOV. When updating the distances array, which stores the shortest known distance from the source vertex to every other vertex, the C compiler computes the minimum using a CMOV instruction, whereas the Rust compiler emits a conditional branch followed by a memory store. While this difference leads to increased branches and therefore more branch mispredictions compared to C, it reduces the number of store instructions from over 1B in C to just over 200K in Rust, ultimately resulting in a 32% to 44% increase in performance for Rust.
6.2.4. Aliasing Impact
Rust’s ownership model also affects how aggressively LLVM can optimize memory accesses. Compilers, such as LLVM (, 2020) and GCC (36), use alias analysis (AA) (Steensgaard, 1996; Andersen, 1994) to determine whether two pointers can refer to the same memory. When the compiler can prove they do not (NoAlias), it can better optimize the memory accesses by reordering or vectorizing them aggressively. LLVM conveys aliasing information through a combination of attributes, annotations, and metadata, which we collectively refer to as alias information. Rust’s borrow checker guarantees that no mutable reference coexists with any other reference to the same memory, and the compiler encodes this by emitting noalias alias information for &mut T and &T pointer parameters in the LLVM IR, which becomes scoped noalias metadata on the individual loads and stores when a function is inlined. C pointers carry no such alias information unless explicitly annotated with the restrict keyword. Instead, C relies on its strict-aliasing rules, which Clang encodes as type-based alias analysis (TBAA) metadata on each load and store, letting LLVM separate accesses of incompatible types (LLVM Project, ; Diwan et al., 1998), while rustc emits no TBAA. One might expect Rust’s ownership-based alias information to result in more NoAlias relationships as hypothesized by Villani et al. (Villani et al., 2025). However, we observe that this behavior is dependent on how the code is implemented and how memory is allocated.
To characterize the impact of Rust’s type system on aliasing information, we executed LLVM’s Alias Analysis (LLVM Project, ) pass (aa-eval) on the O3-optimized IR of the hot functions of PageRank and Matrix Multiplication (Table 7). We report the pass’s load/store queries (--evaluate-aa-metadata), which take each access’s alias information into account, including TBAA and scoped noalias metadata. The aa-eval pass’s default pointer-pair queries omit this metadata and therefore understate NoAlias for both languages.
Slice Type Improves Rust’s AA precision. In PageRank, 24.4% of Rust’s queries are NoAlias, compared to 14.5% for C. This gap arises because the C function takes five raw pointers, of which three are of float type. TBAA separates the float accesses from the integer accesses, but it cannot separate pointers of the same type, so accesses through the three float parameters remain MayAlias. The Rust version’s three immutable slice parameters all carry noalias alias information due to its stronger type system, which resolves exactly these pairs.
Nested Vectors Limit Rust’s AA precision. For Matrix Multiplication, FerroScope’s Phase 2 identified a disconnect between the guarantees provided by Rust’s borrowing rules and what can be communicated to LLVM through noalias annotations. For nested Vec parameters (Vec<Vec<i32>>), noalias applies only to the outer Vec references and cannot convey non-aliasing information about the inner Vecs. As a result, LLVM must conservatively assume that writes through an inner Vec could alias its header. Matrix Multiplication shows the effect of this on alias analysis. In the original i-j-k implementation, none of Rust’s queries are NoAlias, while C resolves 40.0% of them. Each store result[i][j] writes through a row pointer loaded from the outer Vec<Vec<i32>>. Rust’s noalias covers only the references passed to the function, not the rows reached through them, so LLVM cannot rule out that the store overwrites a row header, and it reloads the header and keeps the accumulator in memory. In C, TBAA marks the stores as int accesses and the row pointers as int* accesses, which lets LLVM separate them. We modified the program so that the inner computation is a separate kernel function that takes a shared slice of the row and a mutable reference to the output element. The output address then arrives as a noalias parameter instead of being loaded from memory inside the loop, and Rust’s NoAlias share rises to 18.2%. FerroScope flagged similar situations in the BFS and Pagerank benchmarks.
| PageRank | Matrix Mult. | Matrix Mult. (Mod.) | ||||
|---|---|---|---|---|---|---|
| C | Rust | C | Rust | C | Rust | |
| Total Queries | 297 | 180 | 50 | 42 | 35 | 22 |
| NoAlias | 14.5% | 24.4% | 40.0% | 0.0% | 31.4% | 18.2% |
| MayAlias | 84.2% | 73.3% | 48.0% | 97.6% | 51.4% | 77.3% |
| MustAlias | 1.3% | 2.2% | 12.0% | 2.4% | 17.1% | 4.5% |
| Matrix Mult. | Matrix Mult. (Mod.) | |||||
|---|---|---|---|---|---|---|
| C | Rust | Rust– | C | Rust | Rust– | |
| Runtime (s) | 13.38 | 25.54 | 23.06 | 13.45 | 19.65 | 14.14 |
| Overhead | – | 90.8% | 72.3% | – | 46.0% | 5.1% |
Aliasing Performance Impact. Since alias information can affect code generation, it has the potential to affect performance. The matrix multiplication example shows this. The alias information gained by keeping the kernel as a separate function with the output address known not to alias the row headers allows LLVM promote the accumulator to a register, closer matching C’s code generation. Table 7 shows that Rust’s overhead falls from 90.8% to 46.0%, and that Rust–, which also drops the bounds checks, comes within 5.1% of C.
6.3. Rc<RefCell<>> Overhead
We compare Rust’s Skiplist implementation to a version that uses the unsafe NonNull raw pointer abstraction instead of Rc<RefCell<>> in its primary data structure. Running these through a modified version of FerroScope that allows for Rust-to-Rust comparison shows that Rc<RefCell<>> costs 11–17% per phase (Table 9). The candidate executes 1.7–2.0×\times the instructions of the raw-pointer version for the same number of comparisons. Most of the extra work is inherent to the abstraction. Each node visited during a traversal takes a reference-count increment and decrement and two RefCell borrow-flag checks, and all of these write to the node being visited. Because the traversal is a latency-bound pointer chase, much of this work overlaps with existing memory stalls, and IPC rises from about 0.3 to 0.5. The rest of the overhead comes from layout. The Rc<RefCell<>> node is 64 bytes instead of 40, so its hot fields cross a cache-line boundary more often, and L2 misses in the remove phase rise by 21%. FerroScope also found two missed optimizations. Handles that could stay in registers are stored to and reloaded from the stack on every step, because their addresses escape to an out-of-line drop_slow whose declaration lacks captures(none). Some links are also reloaded because alias information is lost through Rc and Cell. Together these account for an estimated 15–20% of the extra instructions, but only a few percent of the runtime. Both Rust versions are faster than the C implementation in every phase.
7. Compiler Pass for Bounds Check Hoisting
To illustrate the usefulness of our workload characterization we leverage the gained insights into a compiler pass. Our manual analysis reveals that many bounds checks in our benchmarks are unnecessary, but their presence can prevent compiler optimizations that substantially improve performance. We therefore implement an LLVM pass that removes these checks while preserving the precise semantics of Rust bounds-check panics. That is, an out-of-bounds access must still panic at the exact location and time at which it occurs. We argue that such a pass allows programmers to use Rust’s natural indexing operations without worrying about the performance overhead that bounds checks can introduce. The pass derives sound, loop-invariant conditions under which checks are guaranteed to succeed and uses them to version the loop, executing a copy without checks when the conditions hold and retaining the original loop as a fallback otherwise. §9 discusses how our pass improves over prior related work.
7.1. Approach.
The pass treats a conditional branch in a loop LL as a bounds check if its failing result leaves LL and reaches a call that does not return, such as a panic_bounds_check. The pass then expresses each check cc as a comparison x⋈Bx\bowtie B that is true when the check passes, where ⋈\bowtie is an integer comparison (<<, ≤\leq, >>, ≥\geq or ≠\neq, signed or unsigned) and BB is loop invariant. It derives a loop-invariant predicate φc\varphi_{c} that implies cc on every iteration of LL. It then versions LL, where the preheader evaluates Φ=⋀cφc\Phi=\bigwedge_{c}\varphi_{c} (a conjunction of each bounds check condition) once and enters a copy of LL with every check removed if Φ\Phi holds, or the unchanged original loop otherwise. To derive φc\varphi_{c}, the pass tries four rules and uses the first whose operands it can compute in the preheader.
Rule 1: Induction Variables. Suppose xx is an induction variable that starts at ss and changes by the same step dd on every iteration, like a loop counter. Then xx only moves in one direction, so if the check passes for xx’s first and last values, it passes for every value in between. If the loop runs at most NN iterations, xx never goes past s+d⋅(N−1)s+d\cdot(N-1), so φc≡(s⋈B)∧(s+d⋅(N−1)⋈B)\varphi_{c}\equiv(s\bowtie B)\wedge(s+d\cdot(N-1)\bowtie B). This holds only if xx does not overflow or underflow, since a value that wraps around no longer moves in one direction. The pass therefore computes s+d⋅(N−1)s+d\cdot(N-1) in a wider integer type, where it is exact and adds to φc\varphi_{c} the condition that the result fits in xx’s type. To find NN, the pass considers every exit that the loop tests on every iteration, other than the checks themselves, and takes the smallest iteration count among them, since the loop must stop at whichever exit comes first. Exits only taken on some paths, such as within a nested if, are not considered.
Rule 2: Leveraging Existing Guard Conditions. The pass then considers the case that the code already limits xx before the check runs. For example, if every path to the check first passes a test that guarantees x<Mx<M, where MM does not change in the loop, then the check x<Bx<B passes whenever M≤BM\leq B, so φc≡M≤B\varphi_{c}\equiv M\leq B.
Rule 3: Conditionally Assigned Variables. The pass considers the case that xx is chosen conditionally. On each iteration some variable xx either keeps its old value or takes a new value. For example, in Selection Sort’s if arr[j] < arr[min_idx] { min_idx = j; }. In this example, xx always holds one of its candidate values. min_idx starts as i and only ever becomes some j. If each candidate either does not change in the loop or is covered by rule 1, then the check on xx passes whenever it passes for every candidate, so φc\varphi_{c} is the conjunction of the candidates’ predicates. For arr[min_idx], that is i < len together with the predicate for arr[j].
Rule 4: Counter Sum Bounds Analysis. Finally, the pass considers the case where some variable xx advances only together with other counters. Suppose a loop has counters ii, jj and kk, where ii advances on iterations where some condition holds, jj advances on the remaining iterations, and kk advances on every iteration, as in the hot loop of merge sort’s merge function. Then kk has always grown by exactly as much as ii and jj together. If rule 2 bounds ii by MiM_{i} and jj by MjM_{j}, for example through the loop condition, then kk never exceeds k0+(Mi−i0)+(Mj−j0)k_{0}+(M_{i}-i_{0})+(M_{j}-j_{0}), where k0k_{0}, i0i_{0} and j0j_{0} are the starting values, and φc≡k0+(Mi−i0)+(Mj−j0)<B\varphi_{c}\equiv k_{0}+(M_{i}-i_{0})+(M_{j}-j_{0})<B. In general, the pass requires that on every path through the loop body xx grows by no more than the other counters grow together, and that none of them decreases. Rule 1 cannot handle kk since it needs the number of iterations, which LLVM cannot compute when the loop ends on counters that advance irregularly.
7.2. Results.
Table 9 shows the results. With the checks gone, LLVM successfully converts the branches in the merge loop of both merge sorts into CMOV instructions as C does, discussed in §6.2.3. Merge Sort (BUI) then runs slightly faster than C and on-par with Rust– (Table 3). Merge Sort (TDR) retains 17% overhead, close to Rust–’s 20% seen in Table 3. For Selection Sort, the loop without checks is unrolled 4×\times like C’s, discussed in §6.2.2, and the remaining overhead disappears. The pass has no effect on Matrix Multiplication since the bound of matrix_b[k][j] is the length of row k, which changes on every iteration of the hot loop and cannot be proven in the preheader.
| Rust ( NonNull ) | Rust ( Rc<RefCell<>> ) | Overhead | |
|---|---|---|---|
| Insert | 15.80 | 18.43 | 16.6% |
| Remove | 8.07 | 9.35 | 15.9% |
| Search | 4.66 | 5.19 | 11.2% |
| C | Rust | Rust + pass | |
|---|---|---|---|
| Merge Sort (BUI) | 10.53 | 15.02 (1.43 × \times ) | 9.55 (0.91 × \times ) |
| Merge Sort (TDR) | 13.10 | 21.68 (1.65 × \times ) | 15.39 (1.17 × \times ) |
| Selection Sort | 6.81 | 20.09 (2.95 × \times ) | 6.80 (1.00 × \times ) |
| Matrix Mult. | 13.21 | 25.40 (1.92 × \times ) | 25.72 (1.95 × \times ) |
8. Discussion
FerroScope demonstrates that the performance of memory-safe systems languages is a dynamic interplay between the costs of the safety checks, the compiler-level optimizations, and microarchitectural speculation. Future language designs and transpilation systems can leverage this interplay to reconcile safety and performance without manual tuning. The cases where the performance of Rust code falls short reveal opportunities for further work.
Performance Modeling Challenges. Our results show that C-to-Rust transpilation overhead cannot be modeled as a uniform percentage increase. The Rust overhead varies substantially with workload characteristics such as data access and branch behavior. Traditional models that assume stable relationships between abstraction boundaries and microarchitectural events (Van den Steen et al., 2016; Cabezas and Püschel, 2014) are therefore insufficient, and cannot accurately predict the performance cost. This necessitates the development of novel performance models that can accurately predict the performance of the transpiled Rust code from the C version.
Hardware Sensitivity and Generalizability. Our evaluation includes two widely deployed server-class microarchitectures—AMD EPYC and Intel Xeon Silver—which together represent the majority of modern datacenter and HPC deployments (McCarron, 2025; TOP500, 2024). Across both platforms, the key trends hold. Rust implementations that match or outperform C on one architecture generally do so on the other, and the microarchitectural mechanisms responsible are common to both vendors’ designs. This consistency suggests that our findings are likely to generalize to other modern processors. Nonetheless, the magnitude of overhead varies between the two machines, confirming that microarchitectural features such as cache organization, branch predictor design, and out-of-order execution width influence the relative cost of runtime safety checks (Skadron et al., 2002; Nagarakatte et al., 2013). Consequently, the performance ordering between competing implementation strategies may shift across hardware, undermining the notion of a single "best" translation.
Implications for Transpiler Toolchains. The lack of a definitive superior implementation strategy complicates the development of automated C-to-Rust transpiler toolchains. Present-day C-to-Rust transpilation toolchains (Hanliang Zhang et al., ; Emre et al., 2023; Emre et al., 2021) perform a line-by-line transpilation from C to Rust. Such systems would struggle to transpile C-style imperative code to idiomatic Rust paradigms. More recently, LLM-based transpiler toolchains (Yang et al., 2024; Eniser et al., 2024; Bai and Palit, 2025) have proved modestly successful in transpiling C code to idiomatic Rust, but they struggle with correctness (Li et al., 2024b; Yang et al., 2024; Farrukh et al., 2025). Eliciting performant output from these approaches compounds the challenge.
9. Related Works
Several studies have attempted to examined the performance gap between C and Rust. Popescu et al. (Popescu et al., 2021) showed that developers struggle to identify costly bounds checks, and proposed NADER to selectively reintroduce them under a performance budget. Zhang et al. (Zhang et al., 2022) found that Rust benchmarks, when implemented in a C-like manner, generally incur higher overhead than C, due to run-time checks and language constraints. Fromherz and Protzenko (Fromherz and Protzenko, 2024) observed that Rust can outperform unoptimized C but lags behind optimized C and that inlining causes significant gains, while removing bounds checks has little effect. Licona-Luque et al. (Licona-Luque et al., 2026) found that hand-written safe Rust achieves performance comparable to C across a range of benchmarks, but that relative instruction counts can vary substantially across hardware platforms. Li et al. (Li et al., 2024a) reported inconsistent overheads for Rust in Linux drivers, citing coarse-grained locking and array bounds checks as key factors causing degradation, and also noted higher cache/TLB/branch miss rates due to Rust’s ownership patterns. Together, these studies highlight the need for a deeper systematic performance analysis of Rust code translated from C.
AI-assisted Debugging. Recent work has explored using large language models (LLMs) for performance analysis and optimization. POLO (Bai et al., 2025) and SysLLMatic (Peng et al., 2026) use profiling-guided LLM agents to identify performance hotspots and optimize code. Other work focuses on performance diagnosis. Gigiprofiler (Hu et al., 2026) combines LLM reasoning with static analysis and runtime tracking to identify bottlenecks, while Argus (Nitu et al., 2026) and AgentDebug (Panahandeh et al., 2026) use agentic reasoning and runtime evidence to localize performance issues. Our work differs by explaining performance differences between equivalent C and Rust implementations. We develop a multi-stage agent pipeline that combines performance counters, compiler remarks, and disassembly to investigate differences at three levels: programming idioms, compiler optimizations, and microarchitectural behavior. This evidence-driven approach attributes performance differences to their underlying causes rather than simply identifying bottlenecks or generating optimizations.
Compiler Optimization for Runtime Memory Safety Checks Moving bounds checks out of loops is not a new idea. Gupta (Gupta, 1990; Gupta, 1993) and Kolte and Wolfe (Kolte and Wolfe, 1995) hoist checks on induction-variable indices into the preheader, which reports an error before the loop instead of at the faulting access. Java’s precise exceptions forbid that, so Midkiff et al. (Midkiff et al., 1998) split a loop’s iterations into regions that need checks and regions that do not, versioning the loop on a runtime test. Both work for indices that are affine in the loop index. ABCD (Bodík et al., 2000) and later work (Yang et al., 2009) remove only checks they prove redundant at compile time, with no runtime test. JIT compilers hoist or widen checks and recover through deoptimization when a hoisted check fails, as in HotSpot (Würthinger et al., 2007) and LLVM’s LoopPredication (LLVM Project, ). Rust is compiled ahead of time and has no deoptimization, so our pass keeps the original loop as the fallback, as Midkiff et al. do. What is new is the set of checks it can prove. Rules 2–4 handle indices that are not affine functions of the loop counter: indices that are conditionally selected, counters that advance only on some paths, and indices bounded by a guard condition.
LLVM’s inductive range check elimination (IRCE) (LLVM Project, ) is the closest existing pass. Like Midkiff et al., it splits a loop into pre-, main and post-loops and removes checks only from the main loop. It computes the main loop’s range by intersecting each check’s safe range with the loop’s own iteration range, which imposes three requirements: 1) the index must be an affine function of an induction variable with a constant step 2) the bound must be loop invariant and 3) the loop must exit on that same induction variable. None of the hot checks in our benchmarks meets all three of these requirements, and it therefore could not improve the performance of any of our benchmarks.
10. Conclusion
We showed that Rust’s safety checks are not always the dominant source of overhead, as compiler and microarchitectural optimizations often mitigate their costs. Building on these findings, we presented FerroScope, an AI-assisted performance debugger that identifies cross-layer performance bottlenecks and guides safety-preserving compiler optimizations. Together, these contributions provide a systematic approach to understanding, diagnosing, and reducing performance overheads in C-to-Rust migration.
11. AI Use
FerroScope is itself an AI-assisted tool. An LLM coding agent carries out each of its three phases (§5), and the verdicts and diagnoses in §3.3 are its outputs. We checked each diagnosis against our manual analysis of the same benchmark. We used Anthropic’s Claude Code to write the script that plots Figure 2, and we verified the values against the tables programmatically. The authors take full responsibility for the contents of this paper.
References
- Allen Institute for AI (2020) Allen Institute for AI COVID-19 open research dataset (cord-19). Note: https://www.kaggle.com/datasets/allen-institute-for-ai/CORD-19-research-challengeAccessed: 2025-09-28 Cited by: §3.1.
- Andersen (1994) L. O. Andersen Program analysis and specialization for the c programming language. Ph.D. Thesis, University of Cophenhagen. Cited by: §6.2.4.
- [3] (2024) B-tree pages and binary search in sqlite. SQLite Documentation. Note: https://www.sqlite.org/src/file/src/btree.c Cited by: §3.1.
- Backstrom et al. (2006) L. Backstrom, D. Huttenlocher, J. Kleinberg, and X. Lan Group formation in large social networks: membership, growth, and evolution. In Proceedings of the 12th ACM SIGKDD international conference on Knowledge discovery and data mining, pp. 44–54. Cited by: §3.1.
- Bai et al. (2025) J. Bai, R. Xu, S. Wu, D. Yang, J. Zhao, and G. Chen POLO: an LLM-powered project-level code performance optimization framework. In Proceedings of the Thirty-Fourth International Joint Conference on Artificial Intelligence, pp. 7319–7328. External Links: Document Cited by: §9.
- Bai and Palit (2025) Y. Bai and T. Palit RustAssure: differential symbolic testing for llm-transpiled c-to-rust code. In Proceedings of the 40th ACM/IEEE International Conference on Automated Software Engineering (ASE), Cited by: §8.
- Beamer et al. (2015) S. Beamer, K. Asanović, and D. Patterson The gap benchmark suite. arXiv preprint arXiv:1508.03619. Cited by: §3.1, §3.1.
- Bodík et al. (2000) R. Bodík, R. Gupta, and V. Sarkar ABCD: eliminating array bounds checks on demand. In Proceedings of the ACM SIGPLAN 2000 Conference on Programming Language Design and Implementation (PLDI), pp. 321–333. External Links: Document Cited by: §9.
- Boos et al. (2020) K. Boos, N. Liyanage, R. Ijaz, and L. Zhong Theseus: an experiment in operating system structure and state management. In 14th USENIX Symposium on Operating Systems Design and Implementation (OSDI 20), pp. 1–19. External Links: Link Cited by: §1.
- [10] BurntSushi Ripgrep: line-oriented search tool in rust. Note: https://github.com/BurntSushi/ripgrepAccessed: 2025-10-03 Cited by: §3.1.
- Cabezas and Püschel (2014) V. C. Cabezas and M. Püschel Extending the roofline model: bottleneck analysis with microarchitectural constraints. In 2014 IEEE International Symposium on Workload Characterization (IISWC), pp. 222–231. Cited by: §8.
- [12] (–) CFS scheduler — the linux kernel documentation. Note: https://docs.kernel.org/scheduler/sched-design-CFS.html Cited by: §3.1.
- Chetlur et al. (2014) S. Chetlur, C. Woolley, P. Vandermersch, J. Cohen, J. Tran, B. Catanzaro, and E. Shelhamer Cudnn: efficient primitives for deep learning. arXiv preprint arXiv:1410.0759. Cited by: §3.1.
- Consortium (2025) U. Consortium NormalizationTest.txt. Note: https://www.unicode.org/Public/UNIDATA/NormalizationTest.txtUnicode Character Database - Normalization Forms Test File Cited by: §3.1.
- contributors (2007) G. P. /. contributors GCC internals: control and data flow support. Note: https://www.airs.com/dnovillo/200711-GCC-Internals/200711-GCC-Internals-4-cfg-cg-df.pdf Cited by: §3.1.
- [16] G. Contributors Treegion scheduling in gcc. pp. —. Note: https://gcc.gnu.org/projects/sched-treegion.html Cited by: §3.1.
- Corbet (2022) J. Corbet Rust in the linux kernel. LWN.net. Note: Coverage of Rust support merged into Linux for writing drivers External Links: Link Cited by: §1.
- Crates.io (2023) Crates.io E1000-driver crate. Note: https://crates.io/crates/e1000-driverRust crate for Intel e1000 NICs; docs at docs.rs/e1000-driver Cited by: §1.
- Cui (2024) C. Cui Finding performance issues in rust projects. In Proceedings of the 39th IEEE/ACM International Conference on Automated Software Engineering, pp. 2423–2425. Cited by: §1.
- De Melo (2010) A. C. De Melo The new linux ’perf’ tools. In Slides from Linux Kongress, Vol. 18. Cited by: §3.3.
- de Vries (2025) F. de Vries Zlib-rs is faster than C. Note: https://trifectatech.org/blog/zlib-rs-is-faster-than-c/Trifecta Tech Foundation blog. Accessed: 2025-09-20 Cited by: §1.
- Dentato (2025) R. Dentato U8c: fast validating utf-8 encoder/decoder for c. Note: GitHub repositoryAccessed: 2025-09-21 External Links: Link Cited by: §1, §3.1.
- Developers (2007) N. Developers Rust binding for nginx. Note: https://github.com/nginx/ngx-rust Cited by: §1.
- Diwan et al. (1998) A. Diwan, K. S. McKinley, and J. E. B. Moss Type-based alias analysis. In Proceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI), pp. 106–117. External Links: Document Cited by: §6.2.4.
- Duplyakin et al. (2019) D. Duplyakin, R. Ricci, A. Maricq, G. Wong, J. Duerig, E. Eide, L. Stoller, M. Hibler, D. Johnson, K. Webb, A. Akella, K. Wang, G. Ricart, L. Landweber, C. Elliott, M. Zink, E. Cecchet, S. Kar, and P. Mishra The design and operation of CloudLab. In Proceedings of the USENIX Annual Technical Conference (ATC), pp. 1–14. External Links: Link Cited by: §3.3.
- Emre et al. (2023) M. Emre, P. Boyland, A. Parekh, R. Schroeder, K. Dewey, and B. Hardekopf Aliasing limits on translating c to safe rust. Proceedings of the ACM on Programming Languages 7 (OOPSLA1), pp. 551–579. Cited by: §8.
- Emre et al. (2021) M. Emre, R. Schroeder, K. Dewey, and B. Hardekopf Translating c to safer rust. 5, pp. 1–29. Note: Publisher: ACM New York, NY, USA Cited by: §3.1, §8.
- Eniser et al. (2024) H. F. Eniser, H. Zhang, C. David, M. Wang, M. Christakis, B. Paulsen, J. Dodds, and D. Kroening Towards translating real-world code with LLMs: a study of translating to rust. Cited by: §8.
- Esmer et al. (2020) I. M. Esmer et al. New 3rd Gen Intel Xeon Scalable Processor (Codename: Ice Lake-SP). In IEEE Hot Chips 32 Symposium (HCS), Virtual. External Links: Link Cited by: §3.3.
- Farrukh et al. (2025) M. Farrukh, S. Shah, B. Coskun, and M. Polychronakis SafeTrans: llm-assisted transpilation from c to rust. arXiv preprint arXiv:2505.10708. Cited by: §8.
- Fedorova et al. (2010) A. Fedorova, S. Blagodurov, and S. Zhuravlev Managing contention for shared resources on multicore processors. Communications of the ACM 53 (2), pp. 49–57. External Links: Document Cited by: §3.3.
- Fromherz and Protzenko (2024) A. Fromherz and J. Protzenko Compiling c to safe rust, formalized. arXiv preprint arXiv:2412.15042. Cited by: §9.
- Gamble () R. Gamble Libcsv: fast and flexible csv library written in pure ansi c that can read and write csv data.. Note: Accessed: 2025-09-18 External Links: Link Cited by: §3.1.
- Gao et al. (2024) B. Gao, Q. Kang, H. Tee, K. T. N. Chu, A. Sanaee, and D. Jevdjic Scalable and effective page-table and {\{tlb}\} management on {\{numa}\} systems. In 2024 USENIX Annual Technical Conference (USENIX ATC 24), pp. 445–461. Cited by: §2.3.
- [35] (2018) Generic radix trees / sparse arrays — linux kernel documentation. Note: https://www.kernel.org/doc/html/v5.4/core-api/generic-radix-tree.html Cited by: §3.1.
- [36] GNU Compiler Collection. Note: https://gcc.gnu.org Cited by: §6.2.4.
- [37] Google Google/leveldb: a fast key/value storage library. Note: https://github.com/google/leveldbAccessed: 2025-09-27 Cited by: §3.1.
- Gupta (1990) R. Gupta A fresh look at optimizing array bound checking. In Proceedings of the ACM SIGPLAN 1990 Conference on Programming Language Design and Implementation (PLDI), pp. 272–282. External Links: Document Cited by: §9.
- Gupta (1993) R. Gupta Optimizing array bound checks using flow analysis. ACM Letters on Programming Languages and Systems 2 (1–4), pp. 135–150. External Links: Document Cited by: §9.
- [40] C. D. Hanliang Zhang, Y. Yu, and M. Wang Ownership guided c to rust translation. Cited by: §8.
- Hu et al. (2026) Y. Hu, Y. Huang, H. Zheng, Y. Liu, D. Xie, and B. Kasikci Diagnosing performance issues in Application-Defined resources. In 20th USENIX Symposium on Operating Systems Design and Implementation (OSDI 26), Seattle, WA, pp. 647–664. External Links: Link Cited by: §9.
- Intel Corporation (2021) Intel CorporationIntel Xeon Silver 4314 Processor (24M Cache, 2.40 GHz) — Product Specifications(Website) External Links: Link Cited by: §3.3.
- [43] (2025) Introducing rust code in firefox. Note: https://firefox-source-docs.mozilla.org/build/buildsystem/rust.html Cited by: §1.
- [44] (2024) Java platform, standard edition hotspot virtual machine garbage collection tuning guide. Oracle. Note: https://docs.oracle.com/en/java/javase/21/gctuning/index.html Cited by: §1.
- Kolte and Wolfe (1995) P. Kolte and M. Wolfe Elimination of redundant array subscript range checks. In Proceedings of the ACM SIGPLAN 1995 Conference on Programming Language Design and Implementation (PLDI), pp. 270–278. External Links: Document Cited by: §9.
- Landley (2007) R. Landley Red-black trees (rbtree) in linux. Note: https://www.kernel.org/doc/html/v5.9/core-api/rbtree.html Cited by: §3.1.
- Larabel (2025) M. LarabelRust coreutils 0.1 released with big performance gains - can match or exceed gnu speed(Website) Note: Accessed: 2026-04-30 External Links: Link Cited by: §1.
- Leskovec et al. (2009) J. Leskovec, K. J. Lang, A. Dasgupta, and M. W. Mahoney Community structure in large networks: natural cluster sizes and the absence of large well-defined clusters. Internet Mathematics 6 (1), pp. 29–123. Cited by: §3.1.
- Li et al. (2024a) H. Li, L. Guo, Y. Yang, S. Wang, and M. Xu An empirical study of {\{rust-for-linux}\}: the success, dissatisfaction, and compromise. In 2024 USENIX Annual Technical Conference (USENIX ATC 24), pp. 425–443. Cited by: §9.
- Li et al. (2024b) R. Li, B. Wang, T. Li, P. Saxena, and A. Kundu Translating c to rust: lessons from a user study. arXiv preprint arXiv:2411.14174. Cited by: §8.
- [51] Libcsv: a CSV library in ANSI c. External Links: Link Cited by: §1.
- Licona-Luque et al. (2026) J. P. Licona-Luque, L. A. Muñoz-Ubando, M. A. Romo-Chavero, M. A. Jiménez-Osorio, U. García-Cerón, and L. E. Nava-Montero Rust without shortcuts: what safety actually costs. IEEE Access 14 (), pp. 160832–160855. External Links: Document Cited by: §9.
- [53] Linux profiling with performance counters. Note: Accessed: 2025-09-17 External Links: Link Cited by: §1, §3.2, §3.3.
- [54] LLVM Project InductiveRangeCheckElimination pass. Note: https://github.com/llvm/llvm-project/blob/main/llvm/lib/Transforms/Scalar/InductiveRangeCheckElimination.cppAccessed November 10, 2026 Cited by: §9.
- [55] LLVM Project LLVM alias analysis infrastructure — the -aa-eval pass. Note: https://llvm.org/docs/AliasAnalysis.html#the-aa-eval-passAccessed: 2026-05-19 Cited by: §6.2.4.
- [56] LLVM Project LLVM Language Reference Manual. Note: https://llvm.org/docs/LangRef.htmlAccessed: 2026-05-19 Cited by: §1.
- [57] LLVM Project LLVM Remarks. Note: https://llvm.org/docs/Remarks.htmlAccessed: 2026-11-10 Cited by: §1, §6.2.2, §6.2.3.
- [58] LLVM Project LLVM Type Based Alias Analysis. Note: https://llvm.org/docs/LangRef.html#tbaa-metadataAccessed: 2026-05-19 Cited by: §6.2.4.
- [59] LLVM Project LoopPredication pass. Note: https://github.com/llvm/llvm-project/blob/main/llvm/lib/Transforms/Scalar/LoopPredication.cppAccessed November 10, 2026 Cited by: §9.
- Luk et al. (2005) C. Luk, R. Cohn, R. Muth, H. Patil, A. Klauser, G. Lowney, S. Wallace, V. J. Reddi, and K. Hazelwood Pin: building customized program analysis tools with dynamic instrumentation. In Proceedings of the 2005 ACM SIGPLAN conference on Programming language design and implementation, Cited by: §3.3.
- McCarron (2025) D. McCarronMercury Research Q2 2025 x86 Market Share Report(Website) Note: As reported by Network World and Tom’s Hardware External Links: Link Cited by: §8.
- Midkiff et al. (1998) S. P. Midkiff, J. E. Moreira, and M. Snir Optimizing array reference checking in Java programs. IBM Systems Journal 37 (3), pp. 409–452. External Links: Document Cited by: §9.
- Mihajlovic (2025) I. Mihajlovic Rust vs c++: competition or evolution in systems programming for 2026. Note: https://blog.jetbrains.com/rust/2025/12/16/rust-vs-cpp-comparison-for-2026/JetBrains RustRover Blog Cited by: §1.
- Nagarakatte et al. (2013) S. Nagarakatte, M. M. Martin, and S. Zdancewic Hardware-enforced comprehensive memory safety. IEEE Micro 33 (3), pp. 38–47. Cited by: §8.
- Narayanan et al. (2020) V. Narayanan, T. Huang, D. Detweiler, D. Appel, Z. Li, G. Zellweger, and A. Burtsev RedLeaf: isolation and communication in a safe operating system. In 14th USENIX Symposium on Operating Systems Design and Implementation (OSDI 20), pp. 21–39. External Links: Link Cited by: §1.
- Nitin et al. (2025) V. Nitin, R. Krishna, L. L. d. Valle, and B. Ray C2SaferRust: transforming c projects into safer rust with neurosymbolic techniques. arXiv preprint arXiv:2501.14257. Cited by: §3.1.
- Nitu et al. (2026) V. Nitu, H. Songara, K. Sgouras, S. Galanopoulos, K. Kanellopoulos, and O. Mutlu Argus: agentic, reference-calibrated, tree-guided, system-software-level bottleneck localization. External Links: 2609.35508, Link Cited by: §9.
- [68] (2020) Overview of the linux virtual file system (vfs): dentry & dcache. Note: https://www.kernel.org/doc/html/v5.10/filesystems/vfs.html Cited by: §3.1.
- Page et al. (1999) L. Page, S. Brin, R. Motwani, and T. Winograd The pagerank citation ranking: bringing order to the web.. Technical report Stanford infolab. Cited by: §1, §3.1.
- Panahandeh et al. (2026) M. Panahandeh, N. Ezzati-Jivan, and A. Hamou-Lhadj Rethinking performance debugging: from optimization to collaborative reasoning. In Proceedings of the ACM International Conference on the Foundations of Software Engineering: Companion, pp. 1312–1316. External Links: Document Cited by: §9.
- Peng et al. (2026) H. Peng, A. Gupte, R. Hasler, N. J. Eliopoulos, C. Ho, R. Mantri, L. Deng, K. Läufer, G. K. Thiruvathukal, and J. C. Davis SysLLMatic: large language models are software system optimizers. Journal of Systems and Software 240, pp. 112929. External Links: Document Cited by: §9.
- [72] (2020) Pin 3.2 user guide. Note: https://software.intel.com/sites/landingpage/pintool/docs/81205/Pin/html/ Cited by: §3.2, §3.3.
- Popescu et al. (2021) N. Popescu, Z. Xu, S. Apostolakis, D. I. August, and A. Levy Safer at any speed: automatic context-aware safety enhancement for rust. Proceedings of the ACM on Programming Languages 5 (OOPSLA), pp. 1–23. Cited by: §1, §6.2.2, §6.2, §9.
- Purdy (2025) K. Purdy Linux leaders pave a path for rust in kernel, while supporting c veterans. Ars Technica. Note: https://arstechnica.com/gadgets/2025/02/linux-leaders-pave-a-path-for-rust-in-kernel-while-supporting-c-veteransAccessed: 2025-10-07 Cited by: §1.
- Redis (2019) Redis Redis. Redis. Note: https://redis.io/ Cited by: §3.1.
- Redox OS Project (2024) Redox OS Project Redox os. Note: https://www.redox-os.org/ Cited by: §1.
- [77] S. Rudra Rust coreutils are performing worse than gnu coreutils in ubuntu. Note: https://news.itsfoss.com/ubuntu-uutils-performance-issuesAccessed: 2025-09-20 Cited by: §1.
- [78] (2025) Rust programming language. Note: https://www.rust-lang.org/ Cited by: §1.
- [79] Rust — the linux kernel documentation. Note: https://docs.kernel.org/rust/index.htmlAccessed: 2025-10-07 Cited by: §1.
- Ryoo et al. (2017) J. H. Ryoo, N. Gulur, S. Song, and L. K. John Rethinking tlb designs in virtualized environments: a very large part-of-memory tlb. ACM SIGARCH Computer Architecture News 45 (2), pp. 469–480. Cited by: §2.3.
- [81] serde-rs Serde: serialization framework for rust. Note: https://github.com/serde-rs/serdeAccessed: 2025-10-03 Cited by: §3.1.
- Shun and Blelloch (2013) J. Shun and G. E. Blelloch Ligra: a lightweight graph processing framework for shared memory. In Proceedings of the 18th ACM SIGPLAN symposium on Principles and practice of parallel programming, pp. 135–146. Cited by: §3.1, §3.1.
- Skadron et al. (2002) K. Skadron, P. S. Ahuja, M. Martonosi, and D. W. Clark Branch prediction, instruction-window size, and cache size: performance trade-offs and simulation techniques. IEEE Transactions on Computers 48 (11), pp. 1260–1281. Cited by: §8.
- Steensgaard (1996) B. Steensgaard Points-to analysis in almost linear time. In Proceedings of the 23rd ACM SIGPLAN-SIGACT symposium on Principles of programming languages, pp. 32–41. Cited by: §6.2.4.
- [85] F. D. E. Team Facebook/rocksdb: a library that provides an embeddable, persistent key-value store. Note: https://github.com/facebook/rocksdbAccessed: 2025-09-27 Cited by: §3.1.
- The Go Team (2023) The Go Team A guide to the go garbage collector. Note: https://go.dev/doc/gc-guide Cited by: §1.
- The Linux man-pages project (2025) The Linux man-pages project Perf_event_open(2). man7.org. Note: Accessed: 2025-10-10 External Links: Link Cited by: §3.3.
- [88] (2020) The LLVM compiler infrastructure. Note: https://llvm.org/ Cited by: §1, §6.2.4.
- Tock Project (2024) Tock Project Tock os: a secure embedded operating system for microcontrollers. Note: Kernel and drivers written in Rusthttps://www.tockos.org Cited by: §1.
- TOP500 (2024) TOP500TOP500 Highlights – November 2024(Website) External Links: Link Cited by: §8.
- Uber AI × Uber Maps (2022) Uber AI × Uber Maps DeepETA: how uber predicts arrival times. Note: https://www.uber.com/blog/deepeta-how-uber-predicts-arrival-times/Accessed: 2025-09-27 Cited by: §3.1.
- Vadrevu et al. (2024) V. S. P. K. Vadrevu, L. Xing, and W. G. Aref What cannot be skipped about the skiplist: a survey of skiplists and their applications in big data systems.. arXiv preprint arXiv:2403.04582. Cited by: §1, §3.1.
- Van den Steen et al. (2016) S. Van den Steen, S. Eyerman, S. De Pestel, M. Mechri, T. E. Carlson, D. Black-Schaffer, E. Hagersten, and L. Eeckhout Analytical processor performance and power modeling using micro-architecture independent characteristics. IEEE Transactions on Computers 65 (12), pp. 3537–3551. Cited by: §8.
- Villani et al. (2025) N. Villani, J. Hostert, D. Dreyer, and R. Jung Tree borrows. Proceedings of the ACM on Programming Languages 9 (PLDI), pp. 1–24. External Links: Document, Link Cited by: §1, §6.2.4.
- Wallen (2022) J. Wallen Initial support for rust in the linux kernel is finally released. Linux Magazine. Note: https://www.linux-magazine.com/Online/News/Initial-Support-for-Rust-in-the-Linux-Kernel-Is-Finally-ReleasedAccessed: 2025-10-07 Cited by: §1.
- Wang et al. (2020) L. L. Wang, K. Lo, Y. Chandrasekhar, R. Reas, J. Yang, D. Burdick, D. Eide, K. Funk, Y. Katsis, R. M. Kinney, Y. Li, Z. Liu, W. Merrill, P. Mooney, D. A. Murdick, D. Rishi, J. Sheehan, Z. Shen, B. Stilson, A. D. Wade, K. Wang, N. X. R. Wang, C. Wilhelm, B. Xie, D. M. Raymond, D. S. Weld, O. Etzioni, and S. Kohlmeier CORD-19: the COVID-19 open research dataset. In Proceedings of the 1st Workshop on NLP for COVID-19 at ACL 2020, K. Verspoor, K. B. Cohen, M. Dredze, E. Ferrara, J. May, R. Munro, C. Paris, and B. Wallace (Eds.), Online. External Links: Link Cited by: §3.1.
- Wells (2026) M. Wells Rust vs c++: which should you learn in 2026?. Note: https://rustify.rs/articles/rust-vs-cpp-2026Updated April 2026 Cited by: §1.
- [98] (2025) What is ownership?. Note: https://doc.rust-lang.org/book/ch04-01-what-is-ownership.html Cited by: §1.
- Würthinger et al. (2007) T. Würthinger, C. Wimmer, and H. Mössenböck Array bounds check elimination for the Java HotSpot client compiler. In Proceedings of the 5th International Symposium on Principles and Practice of Programming in Java (PPPJ), pp. 125–133. External Links: Document Cited by: §9.
- Yang et al. (2024) A. Z. Yang, Y. Takashima, B. Paulsen, J. Dodds, and D. Kroening VERT: verified equivalent rust transpilation with large language models as few-shot learners. Cited by: §8.
- Yang et al. (2009) K. Yang, Z. Huang, and M. Yang Array bounds check elimination for Java based on sparse representation. In Proceedings of the 7th ACIS International Conference on Software Engineering Research, Management and Applications (SERA), pp. 189–196. Cited by: §9.
- Zhang et al. (2023) H. Zhang, C. David, Y. Yu, and M. Wang Ownership guided c to rust translation. In International Conference on Computer Aided Verification, pp. 459–482. Cited by: §3.1.
- Zhang et al. (2022) Y. Zhang, Y. Zhang, G. Portokalidis, and J. Xu Towards understanding the runtime performance of rust. In Proceedings of the 37th IEEE/ACM International Conference on Automated Software Engineering, pp. 1–6. Cited by: §1, §3.1, §3.3, §4.2, §9.
Appendix A Intel vs. AMD Instruction-Mix Differences
As shown in Table 3 and Table 2, we observe notable differences in dynamic instruction-mix between the Intel and AMD architectures, particularly in store instructions. We used a Pin tool to further analyze the instruction mix and found that in BFS, the Intel platform exhibits a 47% increase in store instructions over AMD for the C implementation and a 60% increase for both Rust and Rust–. Merge Sort (TDR) shows a similar pattern, with increases of 16%, 38%, and 64% for C, Rust, and Rust– respectively. PageRank presents a more nuanced case: Intel shows an approximately 40% increase in stores for both C and Rust– but produces a nearly identical count for standard Rust. We attribute these differences primarily to architecture-specific optimizations within glibc, which uses runtime dispatching, via ifunc, to select architecture-tuned implementations of common functions such as memset and memcpy. For instance, the glibc implementation on Intel may favor repeated STOSB instructions, leveraging the Enhanced REP MOVSB/STOSB capability present on recent Intel processors, whereas the AMD-targeted variant may instead employ wider vectorized MOV instructions. Because a single vectorized store writes more data per instruction than a byte-granularity STOSB, the same operation can produce significantly different dynamic instruction count without altering the performance.