Re: Fastest way to search a string for the occurance of a word??

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Niki Estner (niki.estner_at_cube.net)
Date: 08/10/04


Date: Tue, 10 Aug 2004 18:12:40 +0200

Of course this depends on the length of your string, and to some extent to
its contents, but generally RegEx's are pretty fast. (Faster than
String.IndexOf, for example).

I'd guess the network would be the main bottleneck in the application you
describe, but if matching performance is as critical as you say, I'd suggest
to perform benchmarks of the following alternatives:
- a "bare-hand" Boyer-Moore implementation
- C/C++'s strstr function (uses CPU-specific optimizations)
- RegEx.Match
using real test data.

Post your results, if you're done!

Niki

"msnews.microsoft.com" <TyroneBloombaumbergenthal@welfare.com> wrote in
news:%23Tg49EvfEHA.384@TK2MSFTNGP10.phx.gbl...
> I need to check the request header of every request that is hitting my web
> server and route traffic accordingly. I can think of several ways to do
> this, but I am looking for the FASTEST way. Your advice would be
> appreciated. Thank you.
>
>