Sign in to follow this  
hick18

c#/c++ Dictionary/Map compare

Recommended Posts

hick18    102
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
SiCrane    11839
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

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