Re: Fastest way to search a string for the occurance of a word??
From: Niki Estner (niki.estner_at_cube.net)
Date: 08/10/04
- Next message: Vincent Finn: "Re: C++ Compared to C#"
- Previous message: Stoitcho Goutsev \(100\) [C# MVP]: "Re: Can't set transpparent control as doublce buffer"
- In reply to: msnews.microsoft.com: "Fastest way to search a string for the occurance of a word??"
- Next in thread: Jon Skeet [C# MVP]: "Re: Fastest way to search a string for the occurance of a word??"
- Reply: Jon Skeet [C# MVP]: "Re: Fastest way to search a string for the occurance of a word??"
- Messages sorted by: [ date ] [ thread ]
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.
>
>
- Next message: Vincent Finn: "Re: C++ Compared to C#"
- Previous message: Stoitcho Goutsev \(100\) [C# MVP]: "Re: Can't set transpparent control as doublce buffer"
- In reply to: msnews.microsoft.com: "Fastest way to search a string for the occurance of a word??"
- Next in thread: Jon Skeet [C# MVP]: "Re: Fastest way to search a string for the occurance of a word??"
- Reply: Jon Skeet [C# MVP]: "Re: Fastest way to search a string for the occurance of a word??"
- Messages sorted by: [ date ] [ thread ]