1BRC
The One Billion Row Challenge, in C and Rust.
- Role
- Personal project
- Started
- Sep 2026
- Stack
- C, Rust
- Machine
- Apple M1 Pro, 16 GB
- Links
- Source on GitHub
What it is
26.9 slatest C time for a billion rows.8.7×faster than my first C pass.
Practice in performance-oriented programming on the One Billion Row Challenge: read a billion rows of city temperature readings and print the min, mean and max for every city, as fast as possible. I had no professional experience in either language, so this is a way to learn both.
Rules
- No external library dependencies.
- The computation happens at runtime; nothing is baked into the binary.
- No LLM-written code: every character in the codebase is hand-written.
Progress
Lessons
A first from-scratch hash map in C, and a first string merge sort on its keys. The basics of Rust, and first-hand ownership and borrowing; writing the C version first and then the Rust one made it stick. The common bugs were the classic ones: off-by-one errors, string terminators, out-of-bounds access and memory corruption.