# Pat Shaughnessy

Published articles for Pat Shaughnessy.

This is one page of public article previews, not the complete archive. Follow Next page to continue. Summaries are not the original full articles.

## Compiling Ruby To Machine Language

DevFeed: [Compiling Ruby To Machine Language](<https://devfeed.tech/articles/compiling-ruby-to-machine-language-31808.md>)

Original publisher: [Read original article](<https://patshaughnessy.net/2025/11/17/compiling-ruby-to-machine-language>)

Author: Pat Shaughnessy

Published: 2025-11-17T00:00:00Z

Content type: article

Language: en

Sources: [Pat Shaughnessy](<https://devfeed.tech/sources/pat-shaughnessy.md>)

Topics: [Ruby](<https://devfeed.tech/topics/ruby.md>), [JIT](<https://devfeed.tech/topics/jit.md>), [Compiler](<https://devfeed.tech/topics/compiler.md>), [Assembly](<https://devfeed.tech/topics/assembly.md>), [Code](<https://devfeed.tech/topics/code.md>)

Tags: [compiler](<https://devfeed.tech/tags/compiler.md>), [jit](<https://devfeed.tech/tags/jit.md>), [machine](<https://devfeed.tech/tags/machine.md>), [performance](<https://devfeed.tech/tags/performance.md>), [ruby](<https://devfeed.tech/tags/ruby.md>), [rust](<https://devfeed.tech/tags/rust.md>), [updating-ruby-under-a-microscope](<https://devfeed.tech/tags/updating-ruby-under-a-microscope.md>)

### AI overview

This excerpt explains how Ruby's YJIT compiler identifies frequently called functions and blocks, counts executions, and compiles hot YARV instruction sequences into machine language. It also describes thresholds used for small Ruby programs and Ruby on Rails web applications, along with YJIT blocks.

### Source excerpt

I've started working on a new edition of Ruby Under a Microscope that covers Ruby 3.x. I'm working on this in my spare time, so it will take a while. Leave a comment or drop me a line and I'll email you when it's finished. Here's an excerpt

## YARV's Internal Stack and Your Ruby Stack

DevFeed: [YARV's Internal Stack and Your Ruby Stack](<https://devfeed.tech/articles/yarv-s-internal-stack-and-your-ruby-stack-31807.md>)

Original publisher: [Read original article](<https://patshaughnessy.net/2025/11/10/yarvs-internal-stack-and-your-ruby-stack>)

Author: Pat Shaughnessy

Published: 2025-11-10T00:00:00Z

Content type: article

Language: en

Sources: [Pat Shaughnessy](<https://devfeed.tech/sources/pat-shaughnessy.md>)

Topics: [Ruby](<https://devfeed.tech/topics/ruby.md>), [Code](<https://devfeed.tech/topics/code.md>), [structure](<https://devfeed.tech/topics/structure.md>)

Tags: [code](<https://devfeed.tech/tags/code.md>), [ruby](<https://devfeed.tech/tags/ruby.md>), [structure](<https://devfeed.tech/tags/structure.md>), [updating-ruby-under-a-microscope](<https://devfeed.tech/tags/updating-ruby-under-a-microscope.md>)

### AI overview

This article explains how YARV, Ruby's stack-oriented virtual machine, uses an internal stack and a second stack of rb_control_frame_t structures to track Ruby program call frames.

### Source excerpt

I've started working on a new edition of Ruby Under a Microscope that covers Ruby 3.x. I'm working on this in my spare time, so it will take a while. Leave a comment or drop me a line and I'll email you when it's finished. The content of Chap

## Compiling a Call to a Block

DevFeed: [Compiling a Call to a Block](<https://devfeed.tech/articles/compiling-a-call-to-a-block-31809.md>)

Original publisher: [Read original article](<https://patshaughnessy.net/2025/11/3/compiling-a-call-to-a-block>)

Author: Pat Shaughnessy

Published: 2025-11-03T00:00:00Z

Content type: tutorial

Language: en

Sources: [Pat Shaughnessy](<https://devfeed.tech/sources/pat-shaughnessy.md>)

Topics: [Ruby](<https://devfeed.tech/topics/ruby.md>), [Compiler](<https://devfeed.tech/topics/compiler.md>), [Parser](<https://devfeed.tech/topics/parser.md>), [Code](<https://devfeed.tech/topics/code.md>), [Programming](<https://devfeed.tech/topics/programming.md>)

Tags: [code](<https://devfeed.tech/tags/code.md>), [compiler](<https://devfeed.tech/tags/compiler.md>), [language](<https://devfeed.tech/tags/language.md>), [ruby](<https://devfeed.tech/tags/ruby.md>), [syntax](<https://devfeed.tech/tags/syntax.md>), [updating-ruby-under-a-microscope](<https://devfeed.tech/tags/updating-ruby-under-a-microscope.md>)

### AI overview

An excerpt from a revised edition of Ruby Under a Microscope explains how Ruby's compiler handles a call to the 10.times method with a block. It examines the Prism parser's redesigned abstract syntax tree and the corresponding YARV instruction generation.

### Source excerpt

I've started working on a new edition of Ruby Under a Microscope that covers Ruby 3.x. I'm working on this in my spare time, so it will take a while. Leave a comment or drop me a line and I'll email you when it's finished. This week's excerpt

## Parsing: How Ruby Understands Your Code

DevFeed: [Parsing: How Ruby Understands Your Code](<https://devfeed.tech/articles/parsing-how-ruby-understands-your-code-31806.md>)

Original publisher: [Read original article](<https://patshaughnessy.net/2025/10/27/parsing-how-ruby-understands-your-code>)

Author: Pat Shaughnessy

Published: 2025-10-27T00:00:00Z

Content type: article

Language: en

Sources: [Pat Shaughnessy](<https://devfeed.tech/sources/pat-shaughnessy.md>)

Topics: [Parsing](<https://devfeed.tech/topics/parsing.md>), [Ruby](<https://devfeed.tech/topics/ruby.md>), [Parser](<https://devfeed.tech/topics/parser.md>), [syntax](<https://devfeed.tech/topics/syntax.md>), [tokenization](<https://devfeed.tech/topics/tokenization.md>), [Code](<https://devfeed.tech/topics/code.md>), [Algorithm](<https://devfeed.tech/topics/algorithm.md>)

Tags: [algorithm](<https://devfeed.tech/tags/algorithm.md>), [code](<https://devfeed.tech/tags/code.md>), [parsing](<https://devfeed.tech/tags/parsing.md>), [ruby](<https://devfeed.tech/tags/ruby.md>), [syntax](<https://devfeed.tech/tags/syntax.md>), [tokenization](<https://devfeed.tech/tags/tokenization.md>), [updating-ruby-under-a-microscope](<https://devfeed.tech/tags/updating-ruby-under-a-microscope.md>)

### AI overview

This excerpt explains how Ruby parses source code after tokenization. It describes syntax matching, recursive parsing of subexpressions, and syntax errors when no pattern matches.

### Source excerpt

I've started working on a new edition of Ruby Under a Microscope that covers Ruby 3.x. I'm working on this in my spare time, so it will take a while. Leave a comment or drop me a line and I'll email you when it's finished. Update

## Write Barriers

DevFeed: [Write Barriers](<https://devfeed.tech/articles/write-barriers-31811.md>)

Original publisher: [Read original article](<https://patshaughnessy.net/2025/2/18/write-barriers>)

Author: Pat Shaughnessy

Published: 2025-02-18T00:00:00Z

Content type: tutorial

Language: en

Sources: [Pat Shaughnessy](<https://devfeed.tech/sources/pat-shaughnessy.md>)

Topics: [Ruby](<https://devfeed.tech/topics/ruby.md>), [Code](<https://devfeed.tech/topics/code.md>), [Data structures](<https://devfeed.tech/topics/data-structures.md>)

Tags: [arrays](<https://devfeed.tech/tags/arrays.md>), [beautiful](<https://devfeed.tech/tags/beautiful.md>), [code](<https://devfeed.tech/tags/code.md>), [data-structures](<https://devfeed.tech/tags/data-structures.md>), [ruby](<https://devfeed.tech/tags/ruby.md>), [updating-ruby-under-a-microscope](<https://devfeed.tech/tags/updating-ruby-under-a-microscope.md>)

### AI overview

This tutorial explains Ruby write barriers in incremental and generational garbage collection. Write barriers detect writes to arrays, hashes, and other data structures that may add objects requiring marking; when triggered, Ruby moves the modified object back onto the mark stack for processing during a later garbage-collection step.

### Source excerpt

I've started working on a new edition of Ruby Under a Microscope that covers Ruby 3.x. I'm working on this in my spare time, so it will take a while. Leave a comment or drop me a line and I'll email you when it's finished. Ruby's garbage col

## Using Different Size Pools in Ruby Garbage Collection

DevFeed: [Using Different Size Pools in Ruby Garbage Collection](<https://devfeed.tech/articles/using-different-size-pools-31810.md>)

Original publisher: [Read original article](<https://patshaughnessy.net/2025/2/11/using-different-size-pools>)

Author: Pat Shaughnessy

Published: 2025-02-11T00:00:00Z

Content type: tutorial

Language: en

Sources: [Pat Shaughnessy](<https://devfeed.tech/sources/pat-shaughnessy.md>)

Topics: [Ruby](<https://devfeed.tech/topics/ruby.md>)

Tags: [array](<https://devfeed.tech/tags/array.md>), [gc](<https://devfeed.tech/tags/gc.md>), [ruby](<https://devfeed.tech/tags/ruby.md>), [updating-ruby-under-a-microscope](<https://devfeed.tech/tags/updating-ruby-under-a-microscope.md>)

### AI overview

An excerpt from an updated Ruby garbage-collection chapter explains how to use GC.stat_heap in Ruby 3.2 and later to inspect size-pool statistics while allocating arrays of different capacities.

### Source excerpt

I've started working on a new edition of Ruby Under a Microscope that covers Ruby 3.x. I'm working on this in my spare time, so it will take a while. Leave a comment or drop me a line and I'll email you when it's finished. The Ruby team has done

## Inserting One New Element into Hashes of Varying Sizes

DevFeed: [Inserting One New Element into Hashes of Varying Sizes](<https://devfeed.tech/articles/inserting-one-new-element-into-hashes-of-varying-sizes-31812.md>)

Original publisher: [Read original article](<https://patshaughnessy.net/2025/2/4/inserting-one-new-element-into-hashes-of-varying-sizes>)

Author: Pat Shaughnessy

Published: 2025-02-04T00:00:00Z

Content type: tutorial

Language: en

Sources: [Pat Shaughnessy](<https://devfeed.tech/sources/pat-shaughnessy.md>)

Topics: [Ruby](<https://devfeed.tech/topics/ruby.md>), [hash](<https://devfeed.tech/topics/hash.md>), [Benchmark](<https://devfeed.tech/topics/benchmark.md>), [Code](<https://devfeed.tech/topics/code.md>)

Tags: [benchmark](<https://devfeed.tech/tags/benchmark.md>), [hash](<https://devfeed.tech/tags/hash.md>), [internals](<https://devfeed.tech/tags/internals.md>), [ruby](<https://devfeed.tech/tags/ruby.md>), [table](<https://devfeed.tech/tags/table.md>), [updating-ruby-under-a-microscope](<https://devfeed.tech/tags/updating-ruby-under-a-microscope.md>)

### AI overview

This article presents a Ruby experiment measuring the time required to insert one new element into hashes of different sizes. Using Ruby 3.4.1, it observes timing spikes when the hash grows to certain sizes, consistent with rehashing or redistribution.

### Source excerpt

I've started working on a new edition of Ruby Under a Microscope that covers Ruby 3.x. I'm working on this in my spare time, so it will take a while. Leave a comment or drop me a line and I'll email you when it's finished. RUM includes a serie

## Updating Ruby Under a Microscope

DevFeed: [Updating Ruby Under a Microscope](<https://devfeed.tech/articles/updating-ruby-under-a-microscope-31805.md>)

Original publisher: [Read original article](<https://patshaughnessy.net/2025/1/28/updating-ruby-under-a-microscope>)

Author: Pat Shaughnessy

Published: 2025-01-28T00:00:00Z

Content type: article

Language: en

Sources: [Pat Shaughnessy](<https://devfeed.tech/sources/pat-shaughnessy.md>)

Topics: [Ruby](<https://devfeed.tech/topics/ruby.md>), [hash](<https://devfeed.tech/topics/hash.md>), [Computer science](<https://devfeed.tech/topics/computer-science.md>), [C](<https://devfeed.tech/topics/c.md>)

Tags: [hash](<https://devfeed.tech/tags/hash.md>), [internals](<https://devfeed.tech/tags/internals.md>), [ruby](<https://devfeed.tech/tags/ruby.md>), [updating](<https://devfeed.tech/tags/updating.md>), [updating-ruby-under-a-microscope](<https://devfeed.tech/tags/updating-ruby-under-a-microscope.md>)

### AI overview

An excerpt from a planned new edition of Ruby Under a Microscope explains how Ruby uses hash tables internally. It introduces hash-table organization and describes how Ruby stores keys, values, entries, bins, and related C structures.

### Source excerpt

Ruby stores much of its own internal data in hash tables. I've started working on a new edition of

## LLVM IR: The Esperanto of Computer Languages

DevFeed: [LLVM IR: The Esperanto of Computer Languages](<https://devfeed.tech/articles/llvm-ir-the-esperanto-of-computer-languages-31804.md>)

Original publisher: [Read original article](<https://patshaughnessy.net/2022/2/19/llvm-ir-the-esperanto-of-computer-languages>)

Author: Pat Shaughnessy

Published: 2022-02-19T00:00:00Z

Content type: article

Language: en

Sources: [Pat Shaughnessy](<https://devfeed.tech/sources/pat-shaughnessy.md>)

Topics: [LLVM](<https://devfeed.tech/topics/llvm.md>), [Compiler](<https://devfeed.tech/topics/compiler.md>), [Crystal](<https://devfeed.tech/topics/crystal.md>), [C](<https://devfeed.tech/topics/c.md>), [Rust](<https://devfeed.tech/topics/rust.md>), [Swift](<https://devfeed.tech/topics/swift.md>)

Tags: [c](<https://devfeed.tech/tags/c.md>), [code](<https://devfeed.tech/tags/code.md>), [compiler](<https://devfeed.tech/tags/compiler.md>), [compilers](<https://devfeed.tech/tags/compilers.md>), [crystal](<https://devfeed.tech/tags/crystal.md>), [llvm](<https://devfeed.tech/tags/llvm.md>), [machine](<https://devfeed.tech/tags/machine.md>), [rust](<https://devfeed.tech/tags/rust.md>), [swift](<https://devfeed.tech/tags/swift.md>)

### AI overview

This article explains LLVM IR as an intermediate machine language used by compilers. It describes how languages such as Rust, Swift, Clang-based C, and Crystal can be translated into LLVM IR before LLVM converts it into target-specific machine language.

### Source excerpt

Esperanto grammar is logical and self consistent, designed to be easy to learn.

## Visiting an Abstract Syntax Tree

DevFeed: [Visiting an Abstract Syntax Tree](<https://devfeed.tech/articles/visiting-an-abstract-syntax-tree-31803.md>)

Original publisher: [Read original article](<https://patshaughnessy.net/2022/1/22/visiting-an-abstract-syntax-tree>)

Author: Pat Shaughnessy

Published: 2022-01-22T00:00:00Z

Content type: tutorial

Language: en

Sources: [Pat Shaughnessy](<https://devfeed.tech/sources/pat-shaughnessy.md>)

Topics: [Crystal](<https://devfeed.tech/topics/crystal.md>), [Parser](<https://devfeed.tech/topics/parser.md>), [Compiler](<https://devfeed.tech/topics/compiler.md>), [Data structures](<https://devfeed.tech/topics/data-structures.md>), [Algorithms](<https://devfeed.tech/topics/algorithms.md>), [Programming](<https://devfeed.tech/topics/programming.md>), [Computer science](<https://devfeed.tech/topics/computer-science.md>)

Tags: [algorithms](<https://devfeed.tech/tags/algorithms.md>), [code](<https://devfeed.tech/tags/code.md>), [compiler](<https://devfeed.tech/tags/compiler.md>), [crystal](<https://devfeed.tech/tags/crystal.md>), [data-structure](<https://devfeed.tech/tags/data-structure.md>), [syntax](<https://devfeed.tech/tags/syntax.md>)

### AI overview

This tutorial examines how Crystal uses abstract syntax tree visitors during semantic analysis. It explains the visitor pattern as a way to apply multiple algorithms to the same tree data structure and describes how Crystal's compiler uses visitors to inspect syntax, record type and object information, and potentially transform code.

### Source excerpt

Joshua Tree National Park (via: Wikimedia Commons) In my