From: gast128 on
Hello all,

I am not sure if this is the correct newsgroup, but the information
might be helpful.

The (stdext::) hash_map in combination with strings (used on VStudio
2003 / vc7.1) does not have a good performance. It's actual slower
than std::map<string, ...>. I noticed however that changing the hash
function (with boost::hash_value for example) does make it fast again.
Perhaps there is an issue with the hash function? A small test with
random strings (up to the a length of 2000) gave the following
results:

stdext::hash_value with string:
Mean: 3.73593e+009
Sum: 373592873859453
Min: 3735928607
Max: 3735928779
Var: 919.648

boost::hash_value with string:
Mean: 2.67717e+009
Sum: 267716741970601
Min: 1230214564
Max: 4217158627
Var: 2.11744e+018

It seems that stdext::hash_value has a very narrow distribution, which
may the root of the bad performance.

note: I am aware of the tr1 / boost unordered_map which will superceed
it. However this still may be an important issue for developpers who
dropped hash containers due to bad experience with above combination
(like myself).

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