Jump to content
  • Advertisement
Sign in to follow this  
hick18

c#/c++ Dictionary/Map compare

This topic is 3051 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I wanted to run a quick test to see how these compare in performance, and was very surprised by the results, I expected the C++ code to perform faster. I believe I ran the tests fairly. Also I searched for something that wasnt actually in the trees to get the worst case scenario. (Both performed in release mode) C++ results and code Image and video hosting by TinyPic C# results and code Image and video hosting by TinyPic

Share this post


Link to post
Share on other sites
Advertisement
C++'s std::map is a balanced binary tree. .NET's Dictionary<> is a hash table. These are not the same data structures. If you want a hash table in C++ you can use boost::unordered_map or, if your compiler supports it, std::tr1::unordered_map.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!