Hacker News Front Page · 26 October 2026 · 7 min ·
Billion-query-per-second lookup tables in C++
El artículo presenta una biblioteca de C++23 que genera en tiempo de compilación funciones hash perfectas para conjuntos de claves conocidos, evitando colisiones y búsquedas encadenadas durante la ejecución. Su técnica combina una función basada en la longitud y algunos caracteres con comparaciones vectoriales, y sus pruebas en procesadores Apple M3 Max y M4 registran entre 1,2 y 2 ns por consulta, hasta 13 veces más rápido que `std::unordered_map`.
A lot of software spends its time mapping strings to values. A web server must identify the HTTP method (GET, POST, ...). It must recognize header names. A URL parser must recognize the protocol (http, https, ftp, ...). A compiler must recognize keywords. In C++, the default approach is to put the strings in a … Continue reading Billion-query-per-second lookup tables in C++