Books & Videos

Table of Contents

  1. Chapter 1 Tokenization and Parsing

    1. Tokens: The Words That Make Up the Ruby Language

    2. Experiment 1-1: Using Ripper to Tokenize Different Ruby Scripts

    3. Parsing: How Ruby Understands Your Code

    4. Experiment 1-2: Using Ripper to Parse Different Ruby Scripts

    5. Summary

  2. Chapter 2 Compilation

    1. No Compiler for Ruby 1.8

    2. Ruby 1.9 and 2.0 Introduce a Compiler

    3. How Ruby Compiles a Simple Script

    4. Compiling a Call to a Block

    5. Experiment 2-1: Displaying YARV Instructions

    6. The Local Table

    7. Experiment 2-2: Displaying the Local Table

    8. Summary

  3. Chapter 3 How Ruby Executes Your Code

    1. YARV’s Internal Stack and Your Ruby Stack

    2. Experiment 3-1: Benchmarking Ruby 2.0 and Ruby 1.9 vs. Ruby 1.8

    3. Local and Dynamic Access of Ruby Variables

    4. Experiment 3-2: Exploring Special Variables

    5. Summary

  4. Chapter 4 Control Structures and Method Dispatch

    1. How Ruby Executes an if Statement

    2. Jumping from One Scope to Another

    3. Experiment 4-1: Testing How Ruby Implements for Loops Internally

    4. The send Instruction: Ruby’s Most Complex Control Structure

    5. Calling Normal Ruby Methods

    6. Calling Built-In Ruby Methods

    7. Experiment 4-2: Exploring How Ruby Implements Keyword Arguments

    8. Summary

  5. Chapter 5 Objects and Classes

    1. Inside a Ruby Object

    2. Experiment 5-1: How Long Does It Take to Save a New Instance Variable?

    3. What’s Inside the RClass Structure?

    4. Experiment 5-2: Where Does Ruby Save Class Methods?

    5. Summary

  6. Chapter 6 Method Lookup and Constant Lookup

    1. How Ruby Implements Modules

    2. Ruby’s Method Lookup Algorithm

    3. Experiment 6-1: Modifying a Module After Including It

    4. Constant Lookup

    5. Lexical Scope in Ruby

    6. Experiment 6-2: Which Constant Will Ruby Find First?

    7. Summary

  7. Chapter 7 The Hash Table: The Workhorse of Ruby Internals

    1. Hash Tables in Ruby

    2. Experiment 7-1: Retrieving a Value from Hashes of Varying Sizes

    3. How Hash Tables Expand to Accommodate More Values

    4. Experiment 7-2: Inserting One New Element into Hashes of Varying Sizes

    5. How Ruby Implements Hash Functions

    6. Experiment 7-3: Using Objects as Keys in a Hash

    7. Summary

  8. Chapter 8 How Ruby Borrowed a Decades-Old Idea from Lisp

    1. Blocks: Closures in Ruby

    2. Experiment 8-1: Which Is Faster: A while Loop or Passing a Block to each?

    3. Lambdas and Procs: Treating a Function as a First-Class Citizen

    4. Experiment 8-2: Changing Local Variables After Calling lambda

    5. Summary

  9. Chapter 9 Metaprogramming

    1. Alternative Ways to Define Methods

    2. Experiment 9-1: Who Am I? How self Changes with Lexical Scope

    3. Metaprogramming and Closures: eval, instance_eval, and binding

    4. Experiment 9-2: Using a Closure to Define a Method

    5. Summary

  10. Chapter 10 JRuby: Ruby on the JVM

    1. Running Programs with MRI and JRuby

    2. Experiment 10-1: Monitoring JRuby’s Just-in-Time Compiler

    3. Strings in JRuby and MRI

    4. Experiment 10-2: Measuring Copy-on-Write Performance

    5. Summary

  11. Chapter 11 Rubinius: Ruby Implemented with Ruby

    1. The Rubinius Kernel and Virtual Machine

    2. Experiment 11-1: Comparing Backtraces in MRI and Rubinius

    3. Arrays in Rubinius and MRI

    4. Experiment 11-2: Exploring the Rubinius Implementation of Array#shift

    5. Summary

  12. Chapter 12 Garbage Collection in MRI, JRuby, and Rubinius

    1. Garbage Collectors Solve Three Problems

    2. Garbage Collection in MRI: Mark and Sweep

    3. Experiment 12-1: Seeing MRI Garbage Collection in Action

    4. Garbage Collection in JRuby and Rubinius

    5. Copying Garbage Collection

    6. Generational Garbage Collection

    7. Concurrent Garbage Collection

    8. Experiment 12-2: Using Verbose GC Mode in JRuby

    9. Further Reading

    10. Summary