>replacing character with string in-place in std::string takes 400ms >appending to new std::ostringstream instead of replacing in-place takes 100ms >same thing but with .append() calls to new string takes 15ms i guess replacing in-place does some iterator invaidation and inserting and probably lots of memory gets copies there the 100-15ms difference between streams and just a string is because of virtual calls, probably. didnt know it could make this much of a difference