c#/c++ Dictionary/Map compare

Started by
1 comment, last by hick18 14 years, 1 month ago
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
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.
Ah yes. I should have checked that.

This topic is closed to new replies.

Advertisement