Solving the Prospero challenge

April 25, 2025 — 32 min read

How I wrote a small JIT compiler from scratch, in Rust.

Performance optimization challenges are extremely compelling to me. You have a well defined problem with a deceptively simple solution, and your job is to use any tricks you can to make it run as quickly as possible. You start from a high level idea of how to architect your solution to be performant, and before long you're looking at assembly code and processor performance counters to squeeze the last few drops of performance you can. It's all very engaging.

A few weeks ago a colleague shared Matt Keeter's Prospero Challenge on the office Slack channel, and I immediately knew it would be up my alley.

I've enjoyed hacking away at it even more than I thought I would, so much so that I decided to not just put my solution up on GitHub, but to walk through it step by step in this blog post.

(Hence why this is pretty late compared to when the challenge was posted. Whoops.)

Read More...