A deep examination of the trade‑offs between Rust’s safety guarantees and raw execution speed, drawing on benchmarks, best‑practice recommendations, and real‑world projects presented in the “Rust‑Slides” talk delivered at C++Russia 2026.
Assessing Rust’s Performance: Insights from the C++Russia 2026 Talk

Thesis
Rust promises memory safety without a garbage collector, positioning itself as a direct competitor to C++ for systems‑level development. The central question explored in the Rust‑Slides presentation—available on the GitHub repository—is whether the language’s safety abstractions impose a measurable performance penalty, and if idiomatic Rust can nonetheless approach the speed of carefully tuned C++ code.
Key Arguments
1. Safety vs. Speed: The Core Trade‑off
Rust’s ownership model eliminates data races and many classes of undefined behaviour at compile time. This safety is achieved through zero‑cost abstractions: the compiler erases most high‑level constructs during optimization. The talk demonstrates, through a suite of micro‑benchmarks, that the overhead is often negligible, but certain patterns—particularly heavy use of Arc<Mutex<_>> or excessive trait object indirection—can introduce measurable slow‑downs.
2. Identifying Weak Spots
The presenter highlighted three recurring performance pitfalls:
- Dynamic dispatch: Virtual calls via
dyn Traitincur a pointer indirection that can degrade branch prediction. Benchmarks show a 5‑15 % slowdown compared to monomorphic code. - Bounds checking on slices: Rust inserts runtime checks for safety. While LLVM can often eliminate them, in tight loops over unchecked data the cost can be noticeable. The talk recommends using
unsafeblocks sparingly, guarded by explicit pre‑condition checks, to bypass redundant checks when safety can be guaranteed by logic. - Heap allocation patterns: Frequent allocation of small objects through
BoxorVeccan fragment memory and increase latency. The speaker presented the arena allocator pattern as a mitigation, demonstrating up to a 30 % improvement in allocation‑heavy workloads.
3. Strong Points Where Rust Excels
Conversely, the slides showcase scenarios where Rust outperforms C++:
- Zero‑cost iterators: The iterator adaptor chain (
map,filter,fold) is inlined by LLVM, often yielding tighter code than hand‑written loops in C++ that rely on manual unrolling. - Borrow checker guarantees: By preventing aliasing mutable references, Rust enables more aggressive optimizations such as vectorisation without the need for explicit
restrictqualifiers. - Cargo’s incremental compilation: While not a runtime metric, faster rebuild cycles translate to higher developer productivity, indirectly affecting overall project velocity.
4. Benchmarks and Real‑World Projects
The repository includes a set of benchmark programs derived from popular crates such as serde_json, rayon, and tokio. Results are presented in two tables:
| Benchmark | Rust (release) | C++ (gcc‑12 -O3) | Relative Δ |
|---|---|---|---|
| JSON parse (large file) | 112 ms | 108 ms | +3 % |
| Parallel map‑reduce (10 M items) | 820 ms | 795 ms | +3 % |
| TCP echo server (10 k connections) | 1.02 s | 0.98 s | +4 % |
These figures illustrate that, for idiomatic code, Rust remains within a few percent of C++ performance, with the occasional outlier where unsafe optimizations tip the balance.
5. Countermeasures and Best Practices
The talk concludes with a concise checklist for developers seeking to preserve Rust’s safety while extracting maximum speed:
- Prefer static dispatch: Use generic functions or
impl Traitreturn types instead of trait objects when possible. - Leverage
#[inline(always)]judiciously: In hot paths, explicit inlining can help the optimizer eliminate abstraction overhead. - Batch allocations: Employ arena allocators (
typed‑arena,bumpalo) for short‑lived objects. - Profile with
perforcargo flamegraph: Identify hot spots before resorting tounsafe. - Adopt
rayonfor data‑parallelism: Its work‑stealing scheduler often matches hand‑rolled thread pools in C++.
Implications
If the modest overheads identified can be mitigated through disciplined coding, Rust becomes a viable default for performance‑critical systems—from embedded firmware to high‑frequency trading platforms. The language’s guarantee of memory safety also reduces the cost of post‑deployment debugging, potentially offsetting any residual speed penalty. Moreover, the growing ecosystem of profiling tools (e.g., cargo-llvm-lines, perf‑rust) lowers the barrier for developers to adopt a performance‑first mindset.
Counter‑Perspectives
Critics argue that Rust’s learning curve and the necessity of occasional unsafe blocks dilute the promised safety, especially in large codebases where auditability of unsafe sections becomes a maintenance burden. Additionally, certain low‑level optimizations—such as hand‑crafted SIMD intrinsics—remain more ergonomic in C++ due to longer compiler support and richer library ecosystems. Finally, the benchmarks presented focus on CPU‑bound workloads; I/O‑heavy or GPU‑accelerated scenarios may exhibit different trade‑offs.
Conclusion
The Rust‑Slides talk provides a balanced view: Rust’s safety model does incur a small, measurable cost in specific patterns, yet the language’s zero‑cost abstractions and modern optimizer integration enable performance that is, in most idiomatic cases, comparable to C++. By adhering to the outlined best practices and employing targeted profiling, developers can harness Rust’s guarantees without sacrificing the speed demanded by systems programming.
Further Reading
- The full slide deck (English and Russian) is hosted in the repository’s
slides/directory. - For an in‑depth analysis of Rust’s zero‑cost abstractions, see the paper "Zero‑Cost Abstractions in Rust" linked from the repo’s
reading/folder. - The benchmark scripts can be executed directly via
cargo bench; detailed instructions are in theREADME.md.

Comments
Please log in or register to join the discussion