2 posts with tag branch-prediction

Compile-Time Leverage: Specialization, Branch & Arithmetic Hygiene, and Inlining

How const generics, zero-sized types, branch and arithmetic hygiene, and disciplined inlining hand the Rust compiler enough compile-time facts to make sizes immediate, unused features free, and redundant checks disappear in a lock-free SPSC ring buffer.

· 13 minutes reading time

Zero-Copy on the Hot Path: Reserve/Commit and Fast-Path/Slow-Path Splitting

How a reserve/commit protocol eliminates per-item copies in a lock-free SPSC ring buffer, and how fast-path/slow-path splitting keeps the common case branch-predictable.

· 14 minutes reading time