Celestia
Celestia copied to clipboard
Use unordered_dense for hash tables
The standard library unordered_map
has various issues that make it slow. Might be worth investigating https://github.com/martinus/unordered_dense as a replacement.
(It may also be worth considering Boost flat_map for the case where we actually need a sorted map - e.g. for prefix searching in the name manager)
We don't use unordered_map
in any performance critical code afaik.
The other advantage of unordered_dense is that it offers the possibility for heterogeneous lookups (e.g. use a string_view
to do lookups in a hash table with string
keys), which isn't offered by std::unordered_map
until C++20.