What lies beneath the beautiful code?
summary
Examples use Ruby 1.9 tooling (Ripper, RubyVM::InstructionSequence) and C source files (array.c, string.c, class.c) to show exact mappings: Ruby objects become C structs, Value is typedef'd as unsigned long, immediates are Fixnum/Symbol/true/false/nil, and small strings under ~23 bytes are stored inline. Demonstrations show RString struct layout, copy-on-write and embedded strings optimizations, hash internals via StTable, and a C extension that prints hex addresses to confirm shared versus copied storage.
AI-written summary · about
chapters (31)
- 0:00Introduction
- 0:33About Niranjan
- 1:14What lies beneath
- 1:30What is Ruby
- 1:44Ruby Interpreter
- 2:40Why should we know
- 3:16Lets dive in
- 4:57compiler
- 8:10seasource
- 8:41Ruby evaluator
- 9:34Ruby header
- 9:58Object and class
- 12:08Instance specific behavior
- 12:48Singleton class
- 14:33What is a value
- 14:50Typedef
- 17:15String
- 20:04Heap Allocation
- 20:59See Extension
- 21:23Output
- 21:46Shared Strings
- 23:24CopyOnWrite
- 24:18Verify
- 24:33Embedded Strings
- 27:12Debug Class
- 28:02Slice
- 30:19Hash Mapping
- 32:14Summary
- 32:35C Extensions
- 33:31Thanks
- 33:45Questions
related talks
39mInside Ruby's VM: The TMI Edition.
55mComplex Ruby concepts dummified
41mCoding like it’s 1977: Ruby on the Apple ][
29mA Rails Developer’s Guide To The Ruby VM
39mSteal This Talk: The Best Features Ruby Doesn't Have (Yet)
30mGuide to getting started walking source codes of CRuby
29mIntroduction to CRuby source code
26mReading Ruby - A Visual Walkthrough of the Source Code
