profile picture

6 pages tagged with "intro"

A definitive guide to sealed traits in Rust

April 05, 2023 - 2166 words - 11 mins

For the longest time, I thought that "sealed trait" in Rust was a singular concept implementable in one specific way. To prevent downstream crates from implementing your traits, you make the traits sealed — done, end of story. I was wrong! It turns out there are multiple ways to seal traits, forming a pleasant spectrum of options:

read more

Falsehoods programmers believe about undefined behavior

November 27, 2022 - 2421 words - 13 mins
Undefined behavior (UB) is a tricky concept in programming languages and compilers. Over the many years I've been an industry mentor for MIT's 6.172 Performance Engineering course, An excellent class that I highly recommend. It's very thorough and hands-on, at the expense of also requiring a lot of… read more

Compiler Adventures, part 3: Value Numbering

May 17, 2022 - 3096 words - 16 mins
A beginner-friendly introduction to compilers: follow along as we build a compiler from scratch, or fork the code on GitHub and add your own optimizations too! In this episode: value numbering helps track how values are used in the program. Last time on Compiler Adventures, we implemented constant p… read more

Compiler Adventures, part 2: Constant Propagation

February 17, 2022 - 2392 words - 12 mins
A beginner-friendly introduction to compilers: follow along as we build a compiler from scratch, or fork the code on GitHub and add your own optimizations too! In this episode: propagating constant values to eliminate more instructions. Last time on Compiler Adventures, we wrote an optimization that… read more

Compiler Adventures, part 1: No-op Instructions

February 03, 2022 - 1955 words - 10 mins
A beginner-friendly introduction to compilers: follow along as we build a compiler from scratch, or fork the code on GitHub and add your own optimizations too! In this episode: eliminating no-op instructions. What part of computer science feels most like arcane magic? I'd say compilers. "The ma… read more

How Paxos and Two-Phase Commit Differ

January 26, 2021 - 1115 words - 6 mins
Distributed systems courses frequently introduce the Paxos and two-phase commit (2PC) protocols in quick succession. On one hand, this is a reasonable educational choice, as Paxos and 2PC are both examples of consensus algorithms used in the real world. On the other, it leads many students toward th… read more