1brc merykitty’s magic SWAR: 8 lines of code explained in 3k words

QuestDB is a high-performance time series database with SQL analytics. In a recent blog post, the author discussed optimizations made by contestants in the recent One Billion Row Challenge. A standout technique involved parsing the temperature from CSV files using complex bit manipulation operations, resulting in improved performance by a factor of 40. The code by Quân Anh Mai (GitHub handle @merykitty) utilized a sequence of ALU operations to efficiently extract temperature values from data. This groundbreaking solution, based on the concept of SWAR (SIMD Within A Register), has been widely adopted in top solutions and recognized by experts. The detailed breakdown of the code reveals the magic behind achieving the desired results through logical and arithmetic operations.

https://questdb.io/blog/1brc-merykittys-magic-swar/

To top