I was using a map with a std::string key and while everything was working fine I wasn\'t getting the performance I expected. I searched for places to optimize
Store the std::string as a pointer and then you lose the copy constructor overhead.
But after you have to remember to handle the deletes.
The reason std::string is slow is that is constructs itself. Calls the copy constructor, and then at the end calls delete. If you create the string on the heap you lose the copy construction.