[odb-users] Suggestion: replace map with unordered_map in session
Boris Kolpackov
boris at codesynthesis.com
Wed Jun 6 07:18:20 EDT 2018
Andrew Cunningham <odb at a-cunningham.com> writes:
> 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.
Yes, I think this is a good idea but we should probably wait until we
drop support for C++98. I've added an item to the TODO list. Thanks
for the suggestion and sorry for the delay in replying.
More information about the odb-users
mailing list