What Rust can teach us about Ruby
summary
Compares MRI Ruby’s runtime costs — per-object method tables and a recursive method-lookup that forces allocations — to Rust’s ahead-of-time compilation and optimizations: example Rust function compiles to ~82 lines of assembly then shrinks to ~30 after optimizations, and unused code can be eliminated entirely. Explains monomorphization as zero-cost generics, notes Ruby 1.9’s VM compile step and JRuby’s faster implementation, and cites Yehuda Katz rewriting a ~100-line C string-blank routine as a one-liner Rust gem replacement that runs faster. Uses cargo for Rust packaging.
AI-written summary · about
chapters (29)
- 0:00Introduction
- 2:07Levels of abstraction
- 2:45Tension in programming
- 4:14Operating Systems
- 7:09Intuitions
- 8:17Japanese slide
- 8:51Ruby Under Microscope
- 9:36Ruby is Slow
- 10:21How Programs Get Executed
- 11:12Transpiling
- 12:58Tree structure
- 13:19Tokenized parsing
- 15:09Rust
- 16:46Ruby
- 17:12Calling methods in Ruby
- 19:00Demo program
- 20:18Assembly
- 21:59Complexity
- 22:20Data and behavior
- 23:11Optimizations
- 23:46Empty code
- 24:16Empty program
- 24:56Optimization
- 25:41Traits
- 26:54tbar
- 27:34monomorphization
- 29:09Rust with Ruby
- 30:50Programming languages are cool
- 31:04Turtles








