Sign in to follow this  

c#/c++ Dictionary/Map compare

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

This topic is 2833 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this