Alex Rivera | Logout

google::dense_hash_map vs std::tr1::unordered_map?

Asked 2011-07-04T17:59:08.767
9

I'm working on a Mobile Game for several platforms ( Android, iOS, and some maybe even some kind of console in the future ).

I'm trying to decide whether to use tr1::unordered_map or google::dense_hash_map to retrieve Textures from a Resource Manager (for later binding using OpenGL). Usually this can happen quite a few times per second (N per frame, where my Game is running at ~60 fps)

Considerations are:

  • Performance (memory and cpu wise)
  • Portability

Any ideas or suggestions are welcome.

Edit
Report

1 Answer

0

In a C++ project I developed, I was wondering something similar: which one was best, tr1:unordered_map, boost::unordered_map or std::map? I ended up declaring a typedef, controllable at compilation:

#ifdef UnorderedMapBoost
typedef boost::unordered_map<cell_key, Cell> cell_map;
#else
#ifdef UnorderedMapTR1
typedef std::tr1::unordered_map<cell_key, Cell> cell_map;
#else
typedef std::map<cell_key, Cell>  cell_map;
#endif // #ifdef UnorderedMapTR1
#endif // #ifdef UnorderedMapBoost

I could then control at compile-time which one to use, and profiled it. In my case, the portability ended up being more important, so I normally use std::map.

answered 2011-07-13T15:57:22.757

Your Answer