moderated >> stdext::hashmap and std::map are different perfermance in Multi Threaded Base

by Al Terego » Fri, 03 Jul 2009 03:47:00 GMT

George Neuner wrote:

> <cut />

Regarding the stdext::hash_map vs. std::map subject, a propos the initial
question, say I have a following situation:

std::map< unsigned int, vector< SomeClass > > theMap;
stdext::hash_map< unsigned int, vector< SomeClass > > theHashMap;

So the maps map integers to corresponding vectors of some significance to the
program functionality. :) The structure is used mainly to find( someInt ) or for
assignment using a subscript operator. How would you judge the performance of
this structures; would you expect the stdext::hash_map to outperform the
std::map by default? TIA!

--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]



Similar Threads

1. stdext::hashmap and std::map are different perfermance in Multi Threaded Base

2. How to write a multi value compare function for std::map

Hi,

My key for the map is a class with two strings, group and name as
follows:

class ConfigKey{
public:

	ConfigKey( String group, String key );

	String mGroup;
	String mName;
};


Now I want to do a lookup on both values matching.

So I have defined my own compare functions as follows:

struct cmp_config_key
{
   bool operator()(ConfigKey const *lhs, ConfigKey const *rhs)
   {
	   if( lhs->mGroup < rhs->mGroup ){
		   if( lhs->mKey < rhs->mKey )
			   return true;
	   }

	   return false;

   }
};

Above is not working correctly as it returns some other key when i
call find.  Im not too clear on this weak ordering business and it
gets even more confusing with multiple values acting as the key.

Naturally and intuitively i just want to write

  if( lhs->mGroup == rhs->mGroup ){
		   if( lhs->mKey == rhs->mKey )
			   return true;
	   }

Please could someone correct my function???


3. Multi-threaded Debug DLL works / not Multi-threaded DLL

4. std::maps within std::maps -- optimisation

5. Problems with std::map.insert() and std::map.find()

6. Multi Threaded Eg in Doc/View and Dialog Based

Hi,
can anyone gimme an example of multi-Threaded example for 
Doc/View style and dialog based style pls?
i dont want to use mutex.
i just need to use normal multithreading..
thanks a lot

7. HashMap vs Tree Map (was counting counting)

8. Multi-thread OR Event-based?