Profile

Settings

Loading…

← Papers

Help

FAQ

Which features require signing in?

You can read the commentary, paper info, Model Structure and related papers of public papers without signing in. Sign in to manage your account or contact us about your inquiries.

Can I upload a PDF file?

Upload papers with an arXiv or DOI link; the commentary is public to everyone. Papers whose source and terms of use can't be verified, so the commentary can't be made public, can't be uploaded. Uploading PDF files and keeping papers private are for subscribers only, and a paper uploaded as a file is saved as private only. Searching for official info by title runs only when you press the button.

Are the figures and AI commentary accurate?

Figures come only from the original paper, and only those whose terms of use are verified are shown. The commentary is written by AI and may be wrong. Check important claims, numbers and figure context against the evidence in the original paper.

I want to report a copyright issue.

Terms of use and the source of the original paper are on the Paper info tab. If there's a problem, choose "Paper content, figures and copyright" under Contact us and send the paper link, the part in question, and evidence that you hold the rights. Receiving your report doesn't confirm any rights or remove anything right away. You can see the result of the review under My inquiries.

I forgot my password.

If you signed up with email, use Forgot password in the sign-in window to reset it with your verified email. If you signed up with Google, Naver or Kakao, change your password with that service.

What should I include in an inquiry?

Tell us which screen you were on and what you were doing when the problem happened, along with the paper link. Don't include personal information such as passwords, API keys, verification codes or phone numbers. Inquiries and replies are stored in Refivu and you can see them under My inquiries.

How do I delete my account?

In Settings, under My account, press Delete account. Review what will be deleted and complete identity verification to delete your account. For other requests, choose "Account" under Contact us.

Paper commentary

Cross-Layer Characterization and AI-Assisted Diagnosis of C-to-Rust Performance

Rust's bounds checks are not the main cause of C-to-Rust slowdown

  • Problem Rust's bounds checks are assumed to explain most of the slowdown against C. Compiler optimizations and branch prediction interact with the checks, so their cost is hard to isolate.
  • Method FerroScope is an AI-assisted debugger that diagnoses Rust-versus-C performance gaps.
  • Results Across 8 of the 12 benchmarks, at least one Rust version runs within 10 percent of C or faster. Selection Sort's Rust runtime fell from 2.93x to 0.99x of C on AMD when bounds checks were removed.

Figure 3: FerroScope’s AI-assisted performance debugging pipeline. The phases run only when the Rust runtime
exceeds the C runtime by more than the overhead th…

Fig. 3 . FerroScope’s AI-assisted performance debugging pipeline. The phases run only when the Rust runtime exceeds the C runtime by more than the overhead threshold (10% in our evaluation). Each phase records a verdict and a confidence level (low, medium, or high) in the final report. Phases 1 and 2 answer yes or no to their question, and Phase 3 names the primary driver of the overhead. Only the notes pass to the next phase, as leads that it must verify in its own inputs. Inputs marked * also include the Rust-- build.

Original paper · CC BY 4.0 · Dalton Davis, Kunal Pai, Tapti Palit · Cross-Layer Characterization and AI-Assisted Diagnosis of C-to-Rust Performance · Original paper figure · Extracted the figure area from page 8 of the original PDF.

Why Rust's speed against C is hard to predict

Rust checks temporal safety at compile time but keeps spatial checks at run time. Every index into a vector or slice gets a bounds check, which adds instructions and a branch to the access. A common assumption holds that these checks explain most of the slowdown from C to Rust. The difficulty is that the checks also change what the compiler optimizes and how the branch predictor behaves, so their cost is hard to isolate.

Published Rust ports disagree about their speed relative to C. The Rust zlib port reportedly beat its C baseline, while the Rust port of GNU CoreUtils first ran slower. Earlier research reported overheads up to 2.49x, while newer comparisons put well-optimized Rust within 5 to 10 percent of C on average. Different rewriting strategies also change performance, so a developer can't tell from these figures how much of the gap comes from safety checks.

A 12-benchmark study with a check-free Rust build

The authors compare three builds for each benchmark: the C original, the Rust translation and a Rust-- build. Rust-- is a modified rustc that disables bounds checks on arrays, vectors, slices and string slices, plus integer overflow detection, while other checks such as reference counting stay on.

Runtimes were averaged over three runs on two CloudLab machines, an AMD EPYC 7302P node and an Intel Xeon Silver 4314 node. Both C and Rust were built with the LLVM-21 backend at -O3, using clang-21.1.8 and rustc-1.94.1. Hardware counters measured branch mispredictions and L1-D and L2 cache misses, while Intel Pin traced executed branches, loads and stores.

L3 misses were left out, because the shared L3 cache can be disturbed by operating system activity.

When checks are the cost, and when they aren't

For 8 of the 12 benchmarks, at least one Rust variant landed within 10 percent of C or beat it. Removing checks helped Selection Sort a great deal, moving its index-based runtime from 2.93x to 0.99x of C on AMD. For that benchmark, the checks were the overhead.

For BFS, DFS and Binary Search, removing checks changed the runtime by less than 10 percent. Even the Rust-- builds of BFS and Binary Search ran more than 20 percent slower than C. So the checks can't be the whole story, and the authors attribute the remaining cost to interactions between compiler optimizations and hardware, not to the ASCII to UTF-8 conversion an earlier study blamed.

The implementation style matters as well. Top-down recursive Merge Sort had a 68 percent Rust overhead on AMD, compared to 44 percent for the bottom-up iterative variant. Iterator versions were not always faster: they helped Matrix Multiplication and Merge Sort, while Quicksort's index version stayed close to C.

How branches and caches shape the remaining cost

Each check adds a compare and a conditional branch, so the number of branches rises in Rust. In Merge Sort, Rust executed 2.13x as many dynamic branches as C for the top-down variant and 2.69x for the bottom-up variant. Mispredictions rose by about 18 times and 20 times, respectively. The C code performs 2 index checks per merge step where Rust performs 3, which is part of why the branch counts differ.

Caches can absorb extra memory operations, though. The Rust Skip List search issued 1.78x more loads and 6.92x more stores than C, yet its L1D misses fell by 36 percent. SSSP went the other way: its L1D misses rose by 76 percent, but its runtime still improved by 44 percent on AMD. The authors tie these shifts to compiler optimizations that differ between the two languages.

In Binary Search, the C version made about 5 times as many hardware prefetch requests as the Rust baseline. A raw-pointer Rust version, which skips bounds checks, showed the same low L1D miss counts as the vector version.

How alias information limits LLVM

Rust emits noalias for &mut and & parameters, while Clang attaches type-based alias analysis metadata to every load and store in C. rustc emits no TBAA, so the two languages carry different kinds of alias information. So Rust does not automatically get more NoAlias answers than C.

On PageRank, 24.4 percent of Rust's alias queries returned NoAlias, compared to 14.5 percent for C. The C function takes three float* pointers that TBAA can't tell apart, while Rust's three immutable slices all carry noalias.

Nested vectors broke this advantage in Matrix Multiplication. noalias covers only the outer Vec references, so LLVM must assume that a write through an inner row could alias a row header. In the original i-j-k version none of Rust's queries were NoAlias, while C resolved 40.0 percent. Moving the inner computation into a kernel that takes a slice and a mutable output reference raised Rust's NoAlias share to 18.2 percent.

This change cut Rust's Matrix Multiplication overhead from 90.8 percent to 46.0 percent. Rust--, which also drops the bounds checks, came within 5.1 percent of C. The authors say the kernel lets LLVM keep the accumulator in a register, as C does.

FerroScope: a three-phase diagnosis pipeline

FerroScope runs only when the Rust runtime exceeds C by more than 10 percent. Each of its three phases checks one candidate cause: programming idioms, compiler optimizations or microarchitecture.

Phases 1 and 2 answer yes or no and attach a low, medium or high confidence level. Phase 3 names the primary microarchitectural driver of the overhead. Each phase hands its leads to the next one, which must verify them with its own inputs. An LLM coding agent carries out each of the three phases.

The inputs include source code, LLVM IR, optimization remarks, Pin statistics, objdump output and performance statistics, and the Rust-- build where one exists. FerroScope reproduced all of the manually established explanations. It also sharpened several, for example by finding compiler optimizations blocked by redundant bounds checks and by separating implementation overhead from microarchitectural effects.

The authors checked each diagnosis against their manual analysis of the same benchmark.

Hoisting bounds checks out of loops

Rust's checks sit inside hot loops, and the existing compiler passes can't move them to the preheader even when that is possible in principle. The pass keeps the original loop as a fallback, so the panic still happens at the same point.

The pass treats a conditional branch in a loop as a bounds check when its failing side leaves the loop for a call that does not return. It writes each check as x ⊲⊳ B with B loop invariant, then derives a loop-invariant predicate φc that implies the check on every iteration. The preheader evaluates Φ, the conjunction of all the φc, once and chooses between a check-free copy and the unchanged loop.

For an induction variable with start s and step d, the loop of at most N iterations gives \( \varphi_c \equiv (s \,⊲⊳\, B) \wedge (s + d\cdot(N-1) \,⊲⊳\, B) \). That formula holds only when the counter cannot wrap around, so the pass also checks that the final value fits the counter's type. Other rules cover existing guard conditions, conditionally assigned variables such as Selection Sort's min_idx, and sums of counters such as in Merge.

With the pass, Selection Sort on AMD fell from 2.95x to 1.00x of C. Bottom-up Merge Sort fell from 1.43x to 0.91x of C. Top-down Merge Sort kept about 17 percent overhead. The authors say the removed checks let LLVM convert branches to CMOV and unroll the Selection Sort loop.

The pass has no effect on Matrix Multiplication, because the bound on matrix_b[k][j] is the length of row k, which changes every iteration.

Limits of the evidence

All measurements come from two x86 machines, one AMD EPYC 7302P and one Intel Xeon Silver 4314. The authors observe that the magnitude of overhead differs between the two machines. They expect the findings to generalize to other modern processors, but only these two were tested.

The hoisting pass did not help Matrix Multiplication. L3 misses are not reported. Rust-- is a modified compiler, so its numbers describe a build the authors changed.

The authors argue that traditional models can't predict the cost of transpiled Rust from the C code. They call for new performance models, but the paper does not build one.

Paper info

Authors
Dalton Davis, Kunal Pai, Tapti Palit
Venue
arXiv · Preprint
First published
2026-11-24
Added
2026-11-26
Updated
2026-11-24
Version
v1
arXiv
2611.33490
Category
cs.PF · cs.PL · cs.SE
Original paper terms
CC BY 4.0
What we show
Paper info, commentary and permitted figures from the original paper

AI commentary is a separate explanation from the original paper and may contain errors. The original paper and figures follow each source's terms of use and any rights noted separately.

Abstract

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.95x to 1.00x and improving Merge Sort from 1.43x to 0.91x 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.

Quote from the paper

Dalton Davis, Kunal Pai, Tapti Palit (2026). Cross-Layer Characterization and AI-Assisted Diagnosis of C-to-Rust Performance. arXiv:2611.33490v1. https://arxiv.org/abs/2611.33490v1

BibTeX
@misc{davis2026cross,
  title = {{Cross-Layer Characterization and AI-Assisted Diagnosis of C-to-Rust Performance}},
  author = {Dalton Davis and Kunal Pai and Tapti Palit},
  year = {2026},
  eprint = {2611.33490},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2611.33490v1}
}

See related papersBrowse other papers

Paper preview
Account security

Connect Google account

If you connect a Google account, you can sign in with it too.

Refivu

Delete account

Refivu
Refivu

Sign up