On Tue, Nov 18, 2014 at 8:31 AM, Ernest Zaslavsky <ernest.zaslavsky@sizmek.com> wrote:

[...]. Then when running performance tests I've noticed that once I use composite_key which includes string the performance drops in orders of magnitude, to be precise, 5 orders.


Do you have a requirement to return the wstring by value? Why not by const&? Goes back to Lars' COW string remark.

Also, your "random" string is not random at all, but constant in fact. Isn't that a pathological case?

Unless your indexed members change often, you could also cache the hash. Especially if your string can be long. --DD