• Advertisement
Sign in to follow this  

c#/c++ Dictionary/Map compare

This topic is 2907 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