Speedup of string replace.