I know of two ways of replacing all occurrences of substring in a string.
The regex way (assuming \"substring-to-be-replaced\" doesn\'t include regex specia
Not having done any profiling or benchmarking, I'd say it's a fairly safe bet that if you don't need regex magic, then the overhead of the regular expression parser (which you'll get no matter what, in terms of memory as well as CPU usage) costs you a lot more than you can possibly gain on the other end.