Rewriting a Ruby C Extension in Rust
summary
Rewriting a Ruby C extension in Rust demonstrates that a straightforward Rust implementation of Sam Saffron’s fast_blank outperforms the hand‑written C extension and that a one‑liner style Rust port can be faster than the C gem. It shows the Skylight agent prototype moving heavy instrumentation into Rust, measures a surprising real‑world hotspot (~4% of request time) improved, and explains why no heap allocations, static dispatch and inlining, and zero‑cost abstractions produce C‑level assembly while keeping high‑level code.
AI-written summary · about
chapters (10)
- 0:00Start
- 12:22Naive Rust Implementation
- 13:44Abstractions
- 16:31How Does a Method Work in Rust
- 21:36Allocation
- 23:47Heap Allocation
- 24:26Stack Allocation
- 38:52Zero Cost Abstractions
- 39:43The Closure Syntax in Rust
- 40:58Difference between Rust and Ruby
related talks
44mBending the Curve: How Rust Helped Us Write Better Ruby
40mTurbo Rails with Rust
42mTurbo Rails with Rust
46mRust for Rubyists
40mIntroducing Helix: High-Performance Ruby Made Easy
21mExtending the horizons of R with Rust
32mWhat Rust can teach us about Ruby
43mBending The Curve: Putting Rust in Ruby with Helix
