RSSAmplifier

Blog

Adam Chalmers

Blogging, generally about Rust

blog.adamchalmers.comRSS feed ↗37 posts

Latest posts

My year of reading Chinese history

Last year I read a lot of Chinese history. I didn't expect to find it so interesting! China's history has now become a passion of mine. I want to tell you how I fell down this rabbithole, and why I stayed.

2025 reflections

It's been a good year. We moved back to Austin from New Orleans, I've watched my first kid grow and develop and really start having a personality, and I've had a lot of fun at work.

I am 34

This weekend I turned 34. When friends or family have birthdays, I like to ask them what they're excited for in the coming year. Today someone flipped the question on me, and this is what I answered.

2024 reflections

Better late than never! It's been a really big year. My wife and I had our first baby, we moved to New Orleans (temporarily), I gave my first in-person conference presentation (at RustConf) then flew to Vienna for my second (EuroRust). And Zoo has grown massively. So it's been a fun but crazy year.

EuroRust 2024 talk: Code as contract as code

A few months ago I was invited to EuroRust to talk about API servers and clients. When I worked at Cloudflare, I maintained a few API servers and the official Cloudflare Rust API client. There was a lot of toil and stress involved whenever the API servers changed: schemae had to be updated, and then so did clients. When I joined Zoo I was very impressed to find that our CEO Jess Frazelle had…

RustConf 2024 talk: Building a programming language for CAD

Recently I gave my first-ever in-person conference presentation! I was invited to RustConf 2024 where I talked about why we're building KCL (KittyCAD language), a programming language for 3D design, at Zoo.dev. The talk has three parts: background about computer-aided design (CAD) software and mechanical engineering, then why we built a programming language, then what I learned from the…

My Developer Voices interview

Kris Jenkins of Developer Voices spoke to me on his podcast! We talked about KittyCAD and its language, which I'm building for my work at Zoo . You can listen to it wherever you get your podcasts, or watch it on YouTube. Thanks so much for having me on your podcast, Kris! Developer Voices has become my favourite tech podcast and I really love the range of people he talks to. Kris goes deep…

I'm speaking at RustConf 2024!

I'll be at RustConf 2024, speaking about KCL, the 3D manufacturing language we're building at Zoo.dev ! I'm really excited to present, and to meet a lot of other Rustaceans. If you're going to be in Montreal, send me a message or email (contact details here ) and let's make sure we say hi.

My Kitty terminal config

I've been using Kitty terminal for five years now, and I'm really happy with it. Recently I got curious about how to make it look prettier (inspired by all the beautiful terminals I see in some programmer subreddits). So, keep reading for a little explanation of my Kitty config file. I also made a video showing how I configure a totally fresh Kitty terminal from nothing. But if you…

Video: My VM and its time-travelling debugger

My work at Zoo has recently focused on KCL , our CAD programming language. Currently our modeling app uses a tree-walk interpreter, but for various reasons we've been exploring a proper compiler instead. I've been developing the compiler, called Grackle . It compiles to a bytecode VM (i.e. an abstract machine), called the KCVM. I gave a 10-minute presentation about KCVM and its…

Free users are incredible

Cloudflare has a really generous free tier, and it gets a lot of free users. I often see comments on Hacker News saying "Cloudflare must be doing something shady, so many people use it for free, and if you're not the customer, then you're the product". This is mostly wrong -- Cloudflare gets a lot of value from its free users, in normal, not-shady ways. Here's why it's helpful…

2023 reflections

Thinking about the things I liked and some really fun career changes from the last 12 months.

Video: Error handling

The fourth Rust Club video is up! Every Monday I teach Rust to my coworkers at zoo.dev on video chat. We record the call and put it on YouTube so you can learn too. This week's video is about different ways to handle errors in Rust -- when should you panic and when should you return a Result::Err? And what type should that Result::Err be? Apologies for the low video quality, starting from…

Video: Analyzing performance

KittyCAD 's third Rust Club video is up! We analyze how fast the demo parser from my [first video][/winnow-basics] is, and find ways to speed it up. We use benchmarks to measure its speed, and flamegraphs to visualize its runtime, to find places we can improve. Apologies for the low video quality, I didn't know we'd be releasing this to YouTube, so it's just using…

Investigating crazy compile times

I hate long compiles. I spend hours of my time trying to reduce minutes of compile-time. I recently noticed that the KittyCAD Rust API client was taking an incredibly long time to compile in release mode. Weirdly, the compile time in debug mode was totally fine. I managed to shrink the release compile-times from 33 minutes to 1.5 minutes. Here's how.

Video: Parsing a programming language

KittyCAD 's second Rust Club video is up! My [first video][/winnow-basics] covered the Winnow library for parsing text. Today's video shows you a real-world parser example. I'm working on the KittyCAD language (KCL) for designing CAD models, and this reviews the tokenizer and parser I wrote recently. Apologies for the low video quality, I didn't know we'd be releasing…

Interviewed at Filtra.io

I had a great time talking to Drew of filtra.io ! We talked what KittyCAD does and why we're all-in on Rust. We also get into my past at Cloudflare and why there's so much Rust there. Check out the piece here .

Video: My P99Conf talk on Rust backends

I had a great time presenting at P99Conf ! I watch their talks every year and I always learn a lot. I was really thrilled to present a talk at this year's conference. It's heavily based on my blog post Why use Rust on the backend? . If you missed the talk, you can watch the recording or view the slides here .

Video: Parsing text with Winnow

I work at KittyCAD , and every Monday I teach Rust to my coworkers for an hour. We always record them, so that over time we build up an archive of Rust learning videos. Recently I realized we should put some of them on the internet, because other programmers outside KittyCAD might find them helpful too! This is our first episode, and it's about building parsers with Winnow , a new fork of…

Rustconf 2023 recap

I got back from Rustconf 2023 last week, and I had a great time! I thought I'd write up my impressions of the conference, for anyone curious about what it's actually like.

Missed opportunities for git aliases

I don't pair program very often, but sometimes when you're stuck on a really annoying problem, it can be helpful to have a coworker looking over your shoulder. My new job is fully-remote, so we occasionally screenshare when someone's stuck. One of my favourite things about pair programming is that I get to see the little idiosyncrasies of everyone's workflow. For example, you…

Introduction to HTTP Multipart

Multipart, or "form-encoded data", is something I see everywhere but never had to actually understand or use myself, because HTTP libraries handled it for me. Recently, though, I had to dive deeper into how multipart works, because it's pretty important at both Cloudflare and my new job at KittyCAD. Used correctly, multipart makes your file uploads faster and use less memory. I'm going…

Why use Rust on the backend?

I read and liked Andrew Israel's I love building a startup in Rust. I wouldn't pick it again. It makes a lot of sense! He basically says that his startup prioritizes developer productivity over performance. Sensible choice for a start-up founder to make. If Rust is going to slow your developers down, and you don't need its benefits, then you should definitely consider using a…

I'm on Rustacean Station

Hi all! Allen Wyma of Rustacean Station had me on the podcast to talk about Rust at Cloudflare. We cover why and how Cloudflare started using Rust, how my team specifically works with Rust, and how Cloudflare works. We also go on a big tangent about social security numbers. Give the episode a listen if you'd like.

Signals vs. Servers

Say you're running a long-lived program, like a server. Let's say the server needs to read some files from disk, like certificates or keys. Every so often, the certificates change, so your server has to reload them. How do you tell the server to reload those files? The traditional way is to use Unix signals. Your server listens for a particular signal, like SIGUSR1 (user-defined signal…

2022 reflections

Reflecting on the things I liked in 2022. I started writing this in December 2022 and completely forgot to finish it until February next year.

Illegal satire about Rust

In case you didn't hear, comedy is now legal on Twitter but accounts engaged in parody must include “parody” in their name, not just in bio . Of course, this only made everyone double down . So yesterday, I changed my name to Rust Language and started posting misinformation. The last week on twitter has basically been "the new 3rd grade substitute teacher can't control the class" and…

Solving common problems with Kubernetes

I first learned Kubernetes ("k8s" for short) in 2018, when my manager sat me down and said "Cloudflare is migrating to Kubernetes, and you're handling our team's migration." This was slightly terrifying to me, because I was a good programmer and a mediocre engineer. I knew how to write code, but I didn't know how to deploy it, or monitor it in production. My computer science degree…

Static streams for faster async proxies

Last week in Tokio's Discord chat server someone asked a really interesting question: how can you stream a multipart body from an incoming request into an outgoing request? My struggle to answer this really helped me understand Rust async lifetimes. We'll explore why this is tricky, then design and benchmark a solution.

What are Rust's HTTP extensions?

I learned about extensions when reading the hyper docs . But they also pop up in lots of other Rust web libraries, like http , tonic , and actix-web . So they must be really useful, if so many libraries offer them. But I personally had no idea what they were or how to use them. Today I'm going to explain what extensions really are (a set of values, keyed by type), and how you can use them to…

What I learned from making a DNS client in Rust

Over the last few weeks I built my own DNS client . Mostly because I thought dig (the standard DNS client) was kinda clunky. Partly because I wanted to learn more about DNS. So here's how I built it, and how you can build your own too. It's a great weekend project, and I learned a lot from finishing it.

Parsing DNS headers with Nom

In the last blog post, we learned how to parse binary, bit-by-bit with Nom. I really wanted to give a real-world example of binary protocols, so here's one from Dingo , a basic DNS client I made.

Parsing bitstreams with Nom

Programming languages generally only manipulate bytes (groups of 8 bits). It can be pretty tricky to manipulate single bits. But sometimes you need to -- for example, a DNS header has some 4-bit numbers, and encodes some boolean flags into single bits. So we really need a way to parse binary data without chunking it up into bytes of 8 bits. Luckily, Nom can do this! In the last blog post, we…

Parsing Text with Nom

"Parsing" is turning a stream of raw text or binary into some structured data types, i.e. a Rust type that your code can understand and use. This isn't the textbook definition of parsing, but damnit, this is my blog and my opinion. This tutorial is about nom , my favourite Rust parsing library. It uses a parser combinator approach: you start writing tiny parsers that match, say, a single…

Pin, Unpin, and why Rust needs them

Using async Rust libraries is usually easy. It&#x27;s just like using normal Rust code, with a little async or .await here and there. But writing your own async libraries can be hard. The first time I tried this, I got really confused by arcane, esoteric syntax like T: ?Unpin and Pin<&mut Self> . I had never seen these types before, and I didn&#x27;t understand what they were doing. Now that I…

Grids in Rust, part 2: const generics

In part one , we defined a Grid trait and implemented it using 1D and 2D vectors. Benchmarks revealed that a 1D vector was a better choice than a nested 2D vector. In this post, we&#x27;ll write a new implementation that uses arrays instead of Vec. This should be faster!

Grids in Rust, part 1: nested vs. flat Vecs

While making a raytracer in Rust , I needed an efficient way to store the pixels of a 2D image. In this post, we&#x27;ll compare two different implementations of a 2D grid datatype, dipping our toes into data parallelism with Rayon and benchmarking with Criterion.