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:
Any ideas or suggestions are welcome.
The performance difference are not so dramatic in the case of the GCC compiler. Therefore, the optimized access with std::map is about 20% faster, but the access time of std::unordered_map about 6 times faster.
When it comes to efficiency, there is a huge difference between maps and unordered maps. We must know the internal working of both to decide which one is to be used. You need ordered data. You would have to print/access the data (in sorted order).
Yes, HashMap in java and unordered_map in c++ stl are more or less the same… you can store pointers in java too(Don't forget, in java, everything you deal with is a reference)… hence, HashMap also serves your purpose.
std::unordered_map is an associative container that contains key-value pairs with unique keys. 1. Search, insertion, and removal have average constant-time complexity. 2. Internally, the elements are organized into buckets.
http://attractivechaos.wordpress.com/2008/10/07/another-look-at-my-old-benchmark/
http://attractivechaos.wordpress.com/2008/08/28/comparison-of-hash-table-libraries/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With