Do anyone know if there is a STL interface compatible string class that allocates memory for small strings on the stack (up to a certain threshold) and the heap for larger s
This is antique question, but I feel that this is better that any of the current answers.
http://llvm.org/docs/ProgrammersManual.html#dss_smallstring
Basically it is what you want. BTW tcmalloc increased perf in my (badly designed :D) string alloc intensive program 10%. Also you should profile to prove allocs are your perf problem.