The 1BRC (One Billion Row Challenge) is a Java performance benchmarking exercise that processes one billion temperature records from a text file to compute the minimum, mean, and maximum temperature per weather station. At its core, it is a large-scale data aggregation challenge designed to test how efficiently a Java program can parse and aggregate structured data from a plain text file, serving as both a programming exercise and a benchmark for Java performance optimization.
The project distinguishes itself through a collection of performance-oriented architectural patterns for high-throughput data processing. These include branchless temperature parsing using bitwise operations, CPU-core-local aggregation maps that eliminate lock contention, a custom primitive hash map with long keys and int values to minimize object overhead, and garbage-collection-aware allocation that pre-allocates all working data structures upfront. Additional differentiators include JIT-friendly loop unrolling, memory-mapped file I/O, parallel stream processing across file chunks, and direct memory access via sun.misc.Unsafe to bypass bounds checks.
The project also provides supporting capabilities for benchmarking and profiling, including synthetic dataset generation with configurable parameters for reproducible testing, CPU profiling with flamegraphs to visualize execution time distribution, and tools for measuring and optimizing Java code execution speed against the fixed data processing challenge. The repository includes utilities for generating benchmark data files and profiling application performance to identify bottlenecks.