Potential optimizations of replace()
Imported from http://bugzilla.roxen.com/bugzilla/show_bug.cgi?id=1844
Reported by @grubba
The set-up cost for replace(str, str1, str2) is rather high. Separate out the set-up analogous to the multi-replace case.
replace(str, str1, str2) where str1 and str2 both have length 1 is rather common, and can be handled by a separate replace-function.