I m looking for the fastest way to replace multiple (~500) substrings of a big (~1mb) string. Whatever I have tried it seems that String.Replace is the fastest way of doing
As your input string can be as long as 2Mb, I don't foresee any memory allocation problem. You can load everything in memory and replace your data.
If from BC you ALWAYS needs to replace for AA, a String.Replace will be ok. But, if you need more control, you could use a Regex.Replace:
var input = "ABCDABCABCDABCABCDABCABCDABCD";
var output = Regex.Replace(input, "BC", (match) =>
{
// here you can add some juice, like counters, etc
return "AA";
});