<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-US">
  <generator uri="https://jekyllrb.com/" version="4.3.4">Jekyll</generator>
  <link href="https://blog.peterzhu.ca/feed.xml" rel="self" type="application/atom+xml" />
  <link href="https://blog.peterzhu.ca/" rel="alternate" type="text/html" hreflang="en-US" />
  <updated>2026-11-11T03:47:58+00:00</updated>
  <id>https://blog.peterzhu.ca/feed.xml</id>

  

  
    <title type="html">Peter Zhu</title>
  

  
    <subtitle>Peter&apos;s personal blog mostly about programming and sometimes other stuff.</subtitle>
  

  <author>
    <name>Peter Zhu</name>
    
      <email>peter@peterzhu.ca</email>
    
  </author>

  
    <entry>
      

      <title type="html">ZJIT 🤝 GC: Inlining GC Fastpath in ZJIT</title>
      <link href="https://blog.peterzhu.ca/zjit-gc-fastpath/" rel="alternate" type="text/html" title="ZJIT 🤝 GC: Inlining GC Fastpath in ZJIT" />
      <published>2026-09-01T00:00:00+00:00</published>
      <updated>2026-09-01T00:00:00+00:00</updated>
      <id>https://blog.peterzhu.ca/zjit-gc-fastpath</id>

      <author>
        <name>Peter Zhu</name>
        
          <email>peter@peterzhu.ca</email>
        
      </author>

      
        <summary type="html">Object allocations from the garbage collector are now inlined in ZJIT.</summary>
      
    </entry>
  
    <entry>
      

      <title type="html">Open Source is the Most Fragile and Most Resilient Ecosystem</title>
      <link href="https://blog.peterzhu.ca/open-source-is-the-most-fragile-and-resilient-ecosystem/" rel="alternate" type="text/html" title="Open Source is the Most Fragile and Most Resilient Ecosystem" />
      <published>2025-10-18T00:00:00+00:00</published>
      <updated>2025-10-18T00:00:00+00:00</updated>
      <id>https://blog.peterzhu.ca/open-source-is-the-most-fragile-and-resilient-ecosystem</id>

      <author>
        <name>Peter Zhu</name>
        
          <email>peter@peterzhu.ca</email>
        
      </author>

      
        <summary type="html">Some of my thoughts on the lessons we can learn from the RubyGems situation and how we can move forward.</summary>
      
    </entry>
  
    <entry>
      

      <title type="html">Reworking Memory Management in CRuby</title>
      <link href="https://blog.peterzhu.ca/reworking-memory-management-in-cruby/" rel="alternate" type="text/html" title="Reworking Memory Management in CRuby" />
      <published>2025-09-16T00:00:00+00:00</published>
      <updated>2025-09-16T00:00:00+00:00</updated>
      <id>https://blog.peterzhu.ca/reworking-memory-management-in-cruby</id>

      <author>
        <name>Peter Zhu</name>
        
          <email>peter@peterzhu.ca</email>
        
      </author>

      
        <summary type="html">Shopify sponsors and collaborates with academia to take Ruby to new heights. In this post, we give an overview of what we&apos;ve built in collaboration with the Australian National University.</summary>
      
    </entry>
  
    <entry>
      

      <title type="html">Implementing Embedded TypedData Objects</title>
      <link href="https://blog.peterzhu.ca/implementing-embedded-typeddata-objects/" rel="alternate" type="text/html" title="Implementing Embedded TypedData Objects" />
      <published>2025-06-03T00:00:00+00:00</published>
      <updated>2025-06-03T00:00:00+00:00</updated>
      <id>https://blog.peterzhu.ca/implementing-embedded-typeddata-objects</id>

      <author>
        <name>Peter Zhu</name>
        
          <email>peter@peterzhu.ca</email>
        
      </author>

      
        <summary type="html">We implemented a new feature to TypedData objects in Ruby, called embedded TypedData objects. TypedData objects are used across a wide variety of Ruby types, such as Time, Enumerator, and Method. This feature improves allocation speed and runtime performance, while decreasing memory usage. In this blog post, we&apos;ll look at what TypedData objects are under the hood, how embedded TypedData objects work, and the performance impacts of embedded TypedData objects.</summary>
      
    </entry>
  
    <entry>
      

      <title type="html">Finding Memory Leaks in the Ruby Ecosystem</title>
      <link href="https://blog.peterzhu.ca/finding-memory-leaks-in-the-ruby-ecosystem/" rel="alternate" type="text/html" title="Finding Memory Leaks in the Ruby Ecosystem" />
      <published>2024-07-09T00:00:00+00:00</published>
      <updated>2024-07-09T00:00:00+00:00</updated>
      <id>https://blog.peterzhu.ca/finding-memory-leaks-in-the-ruby-ecosystem</id>

      <author>
        <name>Peter Zhu</name>
        
          <email>peter@peterzhu.ca</email>
        
      </author>

      
        <summary type="html">Until recently, Ruby lacked a mechanism for detecting native-level memory leaks from within Ruby and native gems. This meant that it was hard to analyze Ruby applications that suffered from memory leaks, causing them to consume increasing amounts of memory until the system runs out and terminates the application. In this blog post, we&apos;ll be looking at the RUBY_FREE_AT_EXIT feature, which allows memory leak checkers to find memory leaks in Ruby and in native gems.</summary>
      
    </entry>
  
    <entry>
      

      <title type="html">Autotuner: How to Speed Up Your Rails App</title>
      <link href="https://blog.peterzhu.ca/autotuner/" rel="alternate" type="text/html" title="Autotuner: How to Speed Up Your Rails App" />
      <published>2024-04-24T00:00:00+00:00</published>
      <updated>2024-04-24T00:00:00+00:00</updated>
      <id>https://blog.peterzhu.ca/autotuner</id>

      <author>
        <name>Peter Zhu</name>
        
          <email>peter@peterzhu.ca</email>
        
      </author>

      
        <summary type="html">Ruby&apos;s garbage collector is designed to be adaptable, scaling from short Ruby scripts to running apps that serve millions of requests per second. While it&apos;s designed to be adaptable, it may not work optimally for every use case. For this reason, Ruby&apos;s garbage collector supports many parameters that can be used to tune it. However, the use of these parameters requires knowledge into how the garbage collector works on the inside. Learn how the Autotuner gem can analyze your app&apos;s traffic and provide suggestions for tuning the garbage collector.</summary>
      
    </entry>
  
    <entry>
      

      <title type="html">A Rubyist’s Walk Along the C-side (Part 11): Debugging</title>
      <link href="https://blog.peterzhu.ca/ruby-c-ext-part-11/" rel="alternate" type="text/html" title="A Rubyist’s Walk Along the C-side (Part 11): Debugging" />
      <published>2023-11-04T00:00:00+00:00</published>
      <updated>2023-11-04T00:00:00+00:00</updated>
      <id>https://blog.peterzhu.ca/ruby-c-ext-part-11</id>

      <author>
        <name>Peter Zhu</name>
        
          <email>peter@peterzhu.ca</email>
        
      </author>

      
        <summary type="html">Tips and tricks for the inevitable day: when the C extension crashes.</summary>
      
    </entry>
  
    <entry>
      

      <title type="html">Two Garbage Collection Improvements Made Our Storefronts 8% Faster</title>
      <link href="https://blog.peterzhu.ca/two-garbage-collection-improvements-made-our-storefronts-8-faster/" rel="alternate" type="text/html" title="Two Garbage Collection Improvements Made Our Storefronts 8% Faster" />
      <published>2023-08-08T00:00:00+00:00</published>
      <updated>2023-08-08T00:00:00+00:00</updated>
      <id>https://blog.peterzhu.ca/two-garbage-collection-improvements-made-our-storefronts-8-faster</id>

      <author>
        <name>Peter Zhu</name>
        
          <email>peter@peterzhu.ca</email>
        
      </author>

      
        <summary type="html">At Shopify, we are constantly improving the performance of Ruby for everyone. Based on analysis of and experiments on one of our largest and highest traffic apps, we found two improvements in Ruby&apos;s garbage collector that significantly improved our garbage collector performance, which in turn reduced our response times by 8%.</summary>
      
    </entry>
  
    <entry>
      

      <title type="html">Garbage Collection in Ruby</title>
      <link href="https://blog.peterzhu.ca/notes-on-ruby-gc/" rel="alternate" type="text/html" title="Garbage Collection in Ruby" />
      <published>2023-07-03T00:00:00+00:00</published>
      <updated>2023-07-03T00:00:00+00:00</updated>
      <id>https://blog.peterzhu.ca/notes-on-ruby-gc</id>

      <author>
        <name>Peter Zhu</name>
        
          <email>peter@peterzhu.ca</email>
        
      </author>

      
        <summary type="html">Overview of how Ruby&apos;s garbage collector works.</summary>
      
    </entry>
  
    <entry>
      

      <title type="html">Open Sourcing Shopify’s Ruby Builds</title>
      <link href="https://blog.peterzhu.ca/open-sourcing-shopifys-ruby-builds/" rel="alternate" type="text/html" title="Open Sourcing Shopify’s Ruby Builds" />
      <published>2023-06-16T00:00:00+00:00</published>
      <updated>2023-06-16T00:00:00+00:00</updated>
      <id>https://blog.peterzhu.ca/open-sourcing-shopifys-ruby-builds</id>

      <author>
        <name>Peter Zhu</name>
        
          <email>peter@peterzhu.ca</email>
        
      </author>

      
        <summary type="html">We&apos;ve open sourced the definitions to build the Ruby we use at Shopify in development, testing, and production.</summary>
      
    </entry>
  
    <entry>
      

      <title type="html">A Rubyist’s Walk Along the C-side (Part 10): Benchmarking</title>
      <link href="https://blog.peterzhu.ca/ruby-c-ext-part-10/" rel="alternate" type="text/html" title="A Rubyist’s Walk Along the C-side (Part 10): Benchmarking" />
      <published>2023-04-08T00:00:00+00:00</published>
      <updated>2023-04-08T00:00:00+00:00</updated>
      <id>https://blog.peterzhu.ca/ruby-c-ext-part-10</id>

      <author>
        <name>Peter Zhu</name>
        
          <email>peter@peterzhu.ca</email>
        
      </author>

      
        <summary type="html">Tools and methodologies to benchmark Ruby code.</summary>
      
    </entry>
  
    <entry>
      

      <title type="html">Optimizing Ruby’s Memory Layout: Variable Width Allocation</title>
      <link href="https://blog.peterzhu.ca/variable-width-allocation/" rel="alternate" type="text/html" title="Optimizing Ruby’s Memory Layout: Variable Width Allocation" />
      <published>2022-12-25T00:00:00+00:00</published>
      <updated>2022-12-25T00:00:00+00:00</updated>
      <id>https://blog.peterzhu.ca/variable-width-allocation</id>

      <author>
        <name>Peter Zhu</name>
        
          <email>peter@peterzhu.ca</email>
        
      </author>

      
        <summary type="html">Learn more about Variable Width Allocation, a new feature in Ruby 3.2 that improves performance by optimizing Ruby&apos;s memory layout.</summary>
      
    </entry>
  
    <entry>
      

      <title type="html">A Rubyist’s Walk Along the C-side (Part 9): Circular Buffer Project</title>
      <link href="https://blog.peterzhu.ca/ruby-c-ext-part-9/" rel="alternate" type="text/html" title="A Rubyist’s Walk Along the C-side (Part 9): Circular Buffer Project" />
      <published>2022-10-07T00:00:00+00:00</published>
      <updated>2022-10-07T00:00:00+00:00</updated>
      <id>https://blog.peterzhu.ca/ruby-c-ext-part-9</id>

      <author>
        <name>Peter Zhu</name>
        
          <email>peter@peterzhu.ca</email>
        
      </author>

      
        <summary type="html">Practice your C extensions skills with a small project.</summary>
      
    </entry>
  
    <entry>
      

      <title type="html">A Rubyist’s Walk Along the C-side (Part 8): Exceptions &amp;amp; Error Handling</title>
      <link href="https://blog.peterzhu.ca/ruby-c-ext-part-8/" rel="alternate" type="text/html" title="A Rubyist’s Walk Along the C-side (Part 8): Exceptions &amp;amp; Error Handling" />
      <published>2022-03-29T00:00:00+00:00</published>
      <updated>2022-03-29T00:00:00+00:00</updated>
      <id>https://blog.peterzhu.ca/ruby-c-ext-part-8</id>

      <author>
        <name>Peter Zhu</name>
        
          <email>peter@peterzhu.ca</email>
        
      </author>

      
        <summary type="html">Sometimes things don&apos;t go as expected and need to raise or rescue from errors.</summary>
      
    </entry>
  
    <entry>
      

      <title type="html">rb_gc_force_recycle is Deprecated in Ruby 3.1</title>
      <link href="https://blog.peterzhu.ca/rb_gc_force_recycle-deprecation/" rel="alternate" type="text/html" title="rb_gc_force_recycle is Deprecated in Ruby 3.1" />
      <published>2021-12-14T00:00:00+00:00</published>
      <updated>2021-12-14T00:00:00+00:00</updated>
      <id>https://blog.peterzhu.ca/rb_gc_force_recycle-deprecation</id>

      <author>
        <name>Peter Zhu</name>
        
          <email>peter@peterzhu.ca</email>
        
      </author>

      
        <summary type="html">Are you a maintainer of a Ruby native extension gem? rb_gc_force_recycle will be deprecated in Ruby 3.1. Read to find how it affects you.</summary>
      
    </entry>
  
    <entry>
      

      <title type="html">A Rubyist’s Walk Along the C-side (Part 7): TypedData Objects</title>
      <link href="https://blog.peterzhu.ca/ruby-c-ext-part-7/" rel="alternate" type="text/html" title="A Rubyist’s Walk Along the C-side (Part 7): TypedData Objects" />
      <published>2021-12-03T00:00:00+00:00</published>
      <updated>2021-12-03T00:00:00+00:00</updated>
      <id>https://blog.peterzhu.ca/ruby-c-ext-part-7</id>

      <author>
        <name>Peter Zhu</name>
        
          <email>peter@peterzhu.ca</email>
        
      </author>

      
        <summary type="html">Let&apos;s look at this special type of object that only exists in C extensions called TypedData objects.</summary>
      
    </entry>
  
    <entry>
      

      <title type="html">How ruby_memcheck Finds Memory Leaks in Native Gems</title>
      <link href="https://blog.peterzhu.ca/ruby-memcheck/" rel="alternate" type="text/html" title="How ruby_memcheck Finds Memory Leaks in Native Gems" />
      <published>2021-11-05T00:00:00+00:00</published>
      <updated>2021-11-05T00:00:00+00:00</updated>
      <id>https://blog.peterzhu.ca/ruby-memcheck</id>

      <author>
        <name>Peter Zhu</name>
        
          <email>peter@peterzhu.ca</email>
        
      </author>

      
        <summary type="html">Let&apos;s look at the internals of ruby_memcheck, a tool to find memory leaks in native gems.</summary>
      
    </entry>
  
    <entry>
      

      <title type="html">To Free or Not to Free: A Story About a Memory Leak in Strings</title>
      <link href="https://blog.peterzhu.ca/ruby-str-mem-leak/" rel="alternate" type="text/html" title="To Free or Not to Free: A Story About a Memory Leak in Strings" />
      <published>2021-09-10T00:00:00+00:00</published>
      <updated>2021-09-10T00:00:00+00:00</updated>
      <id>https://blog.peterzhu.ca/ruby-str-mem-leak</id>

      <author>
        <name>Peter Zhu</name>
        
          <email>peter@peterzhu.ca</email>
        
      </author>

      
        <summary type="html">Finding and fixing a memory leak in Ruby strings.</summary>
      
    </entry>
  
    <entry>
      

      <title type="html">A Rubyist’s Walk Along the C-side (Part 6): Classes &amp;amp; Object Oriented Programming</title>
      <link href="https://blog.peterzhu.ca/ruby-c-ext-part-6/" rel="alternate" type="text/html" title="A Rubyist’s Walk Along the C-side (Part 6): Classes &amp;amp; Object Oriented Programming" />
      <published>2021-07-25T00:00:00+00:00</published>
      <updated>2021-07-25T00:00:00+00:00</updated>
      <id>https://blog.peterzhu.ca/ruby-c-ext-part-6</id>

      <author>
        <name>Peter Zhu</name>
        
          <email>peter@peterzhu.ca</email>
        
      </author>

      
        <summary type="html">Defining classes and modules and creating instances of classes.</summary>
      
    </entry>
  
    <entry>
      

      <title type="html">A Rubyist’s Walk Along the C-side (Part 5): Variables</title>
      <link href="https://blog.peterzhu.ca/ruby-c-ext-part-5/" rel="alternate" type="text/html" title="A Rubyist’s Walk Along the C-side (Part 5): Variables" />
      <published>2021-07-08T00:00:00+00:00</published>
      <updated>2021-07-08T00:00:00+00:00</updated>
      <id>https://blog.peterzhu.ca/ruby-c-ext-part-5</id>

      <author>
        <name>Peter Zhu</name>
        
          <email>peter@peterzhu.ca</email>
        
      </author>

      
        <summary type="html">Reading and writing instance variables, class variables, global variables, and constants through the Ruby C API.</summary>
      
    </entry>
  
    <entry>
      

      <title type="html">A Rubyist’s Walk Along the C-side (Part 4): Primitive Data Types</title>
      <link href="https://blog.peterzhu.ca/ruby-c-ext-part-4/" rel="alternate" type="text/html" title="A Rubyist’s Walk Along the C-side (Part 4): Primitive Data Types" />
      <published>2021-06-05T00:00:00+00:00</published>
      <updated>2021-06-05T00:00:00+00:00</updated>
      <id>https://blog.peterzhu.ca/ruby-c-ext-part-4</id>

      <author>
        <name>Peter Zhu</name>
        
          <email>peter@peterzhu.ca</email>
        
      </author>

      
        <summary type="html">The primitive data types in the Ruby C API and how to use them.</summary>
      
    </entry>
  
    <entry>
      

      <title type="html">A Rubyist’s Walk Along the C-side (Part 3): Calling Methods</title>
      <link href="https://blog.peterzhu.ca/ruby-c-ext-part-3/" rel="alternate" type="text/html" title="A Rubyist’s Walk Along the C-side (Part 3): Calling Methods" />
      <published>2021-04-28T00:00:00+00:00</published>
      <updated>2021-04-28T00:00:00+00:00</updated>
      <id>https://blog.peterzhu.ca/ruby-c-ext-part-3</id>

      <author>
        <name>Peter Zhu</name>
        
          <email>peter@peterzhu.ca</email>
        
      </author>

      
        <summary type="html">Calling Ruby methods in C extensions.</summary>
      
    </entry>
  
    <entry>
      

      <title type="html">A Rubyist’s Walk Along the C-side (Part 2): Defining Methods</title>
      <link href="https://blog.peterzhu.ca/ruby-c-ext-part-2/" rel="alternate" type="text/html" title="A Rubyist’s Walk Along the C-side (Part 2): Defining Methods" />
      <published>2021-04-08T00:00:00+00:00</published>
      <updated>2021-04-08T00:00:00+00:00</updated>
      <id>https://blog.peterzhu.ca/ruby-c-ext-part-2</id>

      <author>
        <name>Peter Zhu</name>
        
          <email>peter@peterzhu.ca</email>
        
      </author>

      
        <summary type="html">Defining Ruby methods in C extensions.</summary>
      
    </entry>
  
    <entry>
      

      <title type="html">A Rubyist’s Walk Along the C-side (Part 1): Hello World!</title>
      <link href="https://blog.peterzhu.ca/ruby-c-ext-part-1/" rel="alternate" type="text/html" title="A Rubyist’s Walk Along the C-side (Part 1): Hello World!" />
      <published>2021-03-25T00:00:00+00:00</published>
      <updated>2021-03-25T00:00:00+00:00</updated>
      <id>https://blog.peterzhu.ca/ruby-c-ext-part-1</id>

      <author>
        <name>Peter Zhu</name>
        
          <email>peter@peterzhu.ca</email>
        
      </author>

      
        <summary type="html">Let&apos;s look at how to set up and build your first Ruby C extension!</summary>
      
    </entry>
  
    <entry>
      

      <title type="html">A Rubyist’s Walk Along the C-side</title>
      <link href="https://blog.peterzhu.ca/ruby-c-ext/" rel="alternate" type="text/html" title="A Rubyist’s Walk Along the C-side" />
      <published>2021-03-20T00:00:00+00:00</published>
      <updated>2021-03-20T00:00:00+00:00</updated>
      <id>https://blog.peterzhu.ca/ruby-c-ext</id>

      <author>
        <name>Peter Zhu</name>
        
          <email>peter@peterzhu.ca</email>
        
      </author>

      
        <summary type="html">A series on writing your very first Ruby C extension, from scratch!</summary>
      
    </entry>
  
    <entry>
      

      <title type="html">1.5 is the Midpoint Between 0 and Infinity in Ruby</title>
      <link href="https://blog.peterzhu.ca/ruby-range-bsearch/" rel="alternate" type="text/html" title="1.5 is the Midpoint Between 0 and Infinity in Ruby" />
      <published>2020-11-26T00:00:00+00:00</published>
      <updated>2020-11-26T00:00:00+00:00</updated>
      <id>https://blog.peterzhu.ca/ruby-range-bsearch</id>

      <author>
        <name>Peter Zhu</name>
        
          <email>peter@peterzhu.ca</email>
        
      </author>

      
        <summary type="html">What&apos;s the midpoint between 0 and infinity in Ruby? It&apos;s 1.5 for some reason. What&apos;s the reason you might ask? Read on to find out.</summary>
      
    </entry>
  
    <entry>
      

      <title type="html">The Ruby Inplace Bug</title>
      <link href="https://blog.peterzhu.ca/ruby-inplace-bug/" rel="alternate" type="text/html" title="The Ruby Inplace Bug" />
      <published>2020-11-20T00:00:00+00:00</published>
      <updated>2020-11-20T00:00:00+00:00</updated>
      <id>https://blog.peterzhu.ca/ruby-inplace-bug</id>

      <author>
        <name>Peter Zhu</name>
        
          <email>peter@peterzhu.ca</email>
        
      </author>

      
        <summary type="html">A story about memory corruption inside Ruby when you create strings the wrong way.</summary>
      
    </entry>
  
    <entry>
      

      <title type="html">Creating Ruby Strings in C</title>
      <link href="https://blog.peterzhu.ca/creating-ruby-strings-c/" rel="alternate" type="text/html" title="Creating Ruby Strings in C" />
      <published>2020-11-04T00:00:00+00:00</published>
      <updated>2020-11-04T00:00:00+00:00</updated>
      <id>https://blog.peterzhu.ca/creating-ruby-strings-c</id>

      <author>
        <name>Peter Zhu</name>
        
          <email>peter@peterzhu.ca</email>
        
      </author>

      
        <summary type="html">There are many different ways to create Ruby strings in C, and choosing the wrong one can have catastrophic effects. So which one do you choose?</summary>
      
    </entry>
  
    <entry>
      

      <title type="html">Garbage Collection in Ruby 3.0</title>
      <link href="https://blog.peterzhu.ca/notes-on-ruby-gc-3-0/" rel="alternate" type="text/html" title="Garbage Collection in Ruby 3.0" />
      <published>2020-08-24T00:00:00+00:00</published>
      <updated>2020-08-24T00:00:00+00:00</updated>
      <id>https://blog.peterzhu.ca/notes-on-ruby-gc-3-0</id>

      <author>
        <name>Peter Zhu</name>
        
          <email>peter@peterzhu.ca</email>
        
      </author>

      
        <summary type="html">Overview of how Ruby&apos;s garbage collector works in Ruby 3.0.</summary>
      
    </entry>
  
    <entry>
      

      <title type="html">Tips and tricks in MRI Ruby development</title>
      <link href="https://blog.peterzhu.ca/notes-on-ruby-development/" rel="alternate" type="text/html" title="Tips and tricks in MRI Ruby development" />
      <published>2020-08-21T00:00:00+00:00</published>
      <updated>2020-08-21T00:00:00+00:00</updated>
      <id>https://blog.peterzhu.ca/notes-on-ruby-development</id>

      <author>
        <name>Peter Zhu</name>
        
          <email>peter@peterzhu.ca</email>
        
      </author>

      
        <summary type="html">Tips on development, tools, and debugging in MRI Ruby.</summary>
      
    </entry>
  
</feed>
