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

Tiago Macarios tiagomacarios at gmail.com
Mon Jun 11 03:02:51 EDT 2018


Since most people seem not happy with the unordered_map performance there
seems to be a lot of research going to that area. Here is a nice talk about
it: https://www.youtube.com/watch?v=M2fKMP47slQ
If performance matters to your use case, it might be interesting to use
another (no-std) container.

On Wed, Jun 6, 2018 at 4:18 AM Boris Kolpackov <boris at codesynthesis.com>
wrote:

> 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