From Jason Turner
Watch on YouTube

Summary

This episode compares the performance of std::map with a simple hand-crafted constexpr map implementation. Jason demonstrates how using a constexpr-friendly map implementation results in dramatic runtime performance improvements, showing up to 100x faster lookups in benchmarks. He explains that the constexpr map, despite using a simple linear search algorithm rather than a binary search, enables better compiler optimizations for small to medium size datasets, resulting in fewer heap allocations and potential inlining of lookup code.

Resources

Tags