I'm working on a project in which I must search for a little string (about 40 chars) in a very very large string (we're speaking of about a hundred million chars). I'm searching the fastest way. I've tried several methods: these are the results of benchmarks:
ContainsreturnedTruein 248 ms;IndexOfreturnedTruein 671 ms (I would have never said that!);Containsusing an array instead of a string returnedTruein 48 ms only;
Even though the Contains inside an array seemed to be the best method, I've had a look at some search algoritms too (Knuth–Morris–Pratt, Rabin-Karp and Boyer-Moore), but none of them seems to be suitable for my scenario
My question is: is there a faster way to search a little string in a very big string?
Thanks,
PWhite