noexcept affects libstdc++’s unordered_set

Open link in next tab

noexcept affects libstdc++’s unordered_set

https://quuxplusone.github.io/blog/2024/08/16/libstdcxx-noexcept-hash/

The other day I learned a new place where adding or removing noexcept can change the performance of your program: GNU libstdc++’s hash-based associative containers change the struct layout of their nodes depending on the noexceptness of your hash function. This is laid out fairly clearly in the docs; it’s simply bizarre enough that I’d never thought to look for such a thing in the docs!