google::dense

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.


    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/


    go with the STL for standard containers. They have predictable behavior, and can be used seamlessly in STL algos/iterators. You're also given some performance guarantees by the STL.

    This should also guarantee portability. Most compilers have the new standard implemented.


    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 .

    链接地址: http://www.djcxy.com/p/53518.html

    上一篇: 找到一组点是否描述凸包的算法

    下一篇: 谷歌::密