Ruby Racing: Challenging Ruby Methods
summary
Built a Ruby racer gem that runs user implementations against library methods for arrays and numerals, using Ripper and bytecode disassembly to inspect what's happening. Benchmarks show while loops 12% faster than block-based each for tight loops, and array assignment 10% slower than push in one test. flatten uses a stack and while loop in C, uniq is implemented via hash lookups, and results vary by input and isolation — sometimes custom Ruby wins, complex algorithms favor the C versions.
AI-written summary · about
chapters (8)
- 0:00Introduction and background
- 2:02Ruby runtime execution
- 6:54Ruby Racing concept
- 10:30Demo of method racing
- 16:44Factors for faster Ruby
- 19:45Source code deep dive
- 23:40Code quality and Ruby benefits
- 25:28Resources and closing








