[odb-users] Suggestion: replace map with unordered_map in session

Andrew Cunningham odb at a-cunningham.com
Thu Mar 15 18:51:15 EDT 2018


Hi,
I am using a custom "session" object which is essentially a copy of the
default ODB session. I saw significant performance improvements replacing
std::map with std::unordered_map  - I have millions of objects in the
session cache.

My suggestion would be to replace map with unordered_map in the default
odb::session as well. I did some tests and can't find a scenario in which
std::unordered_map  is slower as it automatically rehashes to avoid
excessive hash collisions.


Andrew


More information about the odb-users mailing list