I'm using C# to continuously search for multiple string "keywords" within large strings, which are >= 4kb. This code is constantly looping, and sleeps aren't cutting down CPU usage enough while maintaining a reasonable speed. The bog-down is the keyword matching method.
I've found a few possibilities, and all of them give similar efficiency.
-I do not have enough keywords for this to be the most efficient algorithm.
2) Regex. Using an instance level, compiled regex.
-Provides more functionality than I require, and not quite enough efficiency.
-I would need to do a "smart" version of this for it provide enough efficiency. Looping through each keyword and calling IndexOf doesn't cut it.
Does anyone know of any algorithms or methods that I can use to attain my goal?