0:00 / 0:00
Can One Thread Handle a Billion Rows?
nubskr
3.5K subscribers • 6 videos on Hallway
- Recommended by 1 person: 1 in engineering communities.
Advanced. Deep dive for people who know the field.
18K views2 months ago1 recommendation
Systems programmingComputer scienceZigPerformance and optimizationAlgorithms
An in-depth walkthrough of optimizing a single-threaded Zig program to process one billion rows of temperature data.
Watch more building from scratch videos: youtube.com/playlist?list=PLW4HlYGac2eU In this video, I take on the Billion Row Challenge, or 1BRC, using Zig and a single thread. The Billion Row Challenge is a performance programming challenge where a program processes a text file containing one billion temperature measurements. Each row contains a weather station name and a temperature, and the goal is to calculate the minimum, mean, and maximum temperature for every station. The input file used in this video is about 14 GB and the challenge allows up to 10,000 different weather station names. I start with a simple single threaded implementation and then optimize it step by step. I use profiling to find where the program is actually spending time, look at the cost of floating point parsing and hash map operations, replace temperature parsing with integer arithmetic, use mmap for file access, and measure how each change affects performance. The video focuses on systems programming, performance optimization, profiling, file IO, hash maps, integer parsing, mmap, Linux perf, Zig, and processing very large text files efficiently. What is the Billion Row Challenge? Building the Naive Version Tracking Stats Let's Benchmark Is This Even Correct? Profiling the Bottlenecks Floats Are Evil Benchmarking the Integer Version Can mmap Save Us? How Far Can One Thread Go? #zig #systemsprogrammingWhy it's here
1 person recommends thisWhat people say. Recommended as an excellent demonstration of profiling and low-level optimization techniques in Zig.