469,957 Members | 2,668 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,957 developers. It's quick & easy.

Regex performance?

Anyone have any ideas on how fast .NET regexes are when operating on large
amounts of text?
(the input could be, say, 10KB of text, the regex's pattern would be fairly
big ( getting on for 1KB perhaps, but non-too complex as 90% of that would
be just lots of words strung together)
particularly when using the MatchEvaluator delegate.

Thanks
Nov 16 '05 #1
3 4010
There are statistical methods for finding a fixed string within a much larger
string
that allows you to jump over large amounts of text. In this single case a Regex
may perform more quickly than some other form of search over top of the string.

I will say that expressions are best at matching patterns, not at fixed
matching.
To state this properly expressions are a set of tools for specifying and
matching
unknown strings of a preset format. Because of the generality they often
sacrifice
speed, even when compiled.

--
Justin Rogers
DigiTec Web Consultants, LLC.
Blog: http://weblogs.asp.net/justin_rogers

"Beeeeeves" <1234512345789123456789> wrote in message
news:OA*************@TK2MSFTNGP11.phx.gbl...
Anyone have any ideas on how fast .NET regexes are when operating on large
amounts of text?
(the input could be, say, 10KB of text, the regex's pattern would be fairly
big ( getting on for 1KB perhaps, but non-too complex as 90% of that would
be just lots of words strung together)
particularly when using the MatchEvaluator delegate.

Thanks

Nov 16 '05 #2
Beeeeeves,

I haven't seen any numbers for when using the MatchEvaluator delegate,
but in general, using RegEx is fast (especially if you compile it, which you
can do through one of the settings).

When in doubt though, test. You seem to have all the information you
need to run some tests and produce the numbers (the performance, that is)
you need.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Beeeeeves" <1234512345789123456789> wrote in message
news:OA*************@TK2MSFTNGP11.phx.gbl...
Anyone have any ideas on how fast .NET regexes are when operating on large
amounts of text?
(the input could be, say, 10KB of text, the regex's pattern would be fairly big ( getting on for 1KB perhaps, but non-too complex as 90% of that would
be just lots of words strung together)
particularly when using the MatchEvaluator delegate.

Thanks

Nov 16 '05 #3
Yes, I think profiling's the way to go
Thanks

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in
message news:O9**************@TK2MSFTNGP09.phx.gbl...
Beeeeeves,

I haven't seen any numbers for when using the MatchEvaluator delegate,
but in general, using RegEx is fast (especially if you compile it, which you can do through one of the settings).

When in doubt though, test. You seem to have all the information you
need to run some tests and produce the numbers (the performance, that is)
you need.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Beeeeeves" <1234512345789123456789> wrote in message
news:OA*************@TK2MSFTNGP11.phx.gbl...
Anyone have any ideas on how fast .NET regexes are when operating on large amounts of text?
(the input could be, say, 10KB of text, the regex's pattern would be

fairly
big ( getting on for 1KB perhaps, but non-too complex as 90% of that would be just lots of words strung together)
particularly when using the MatchEvaluator delegate.

Thanks


Nov 16 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

9 posts views Thread by Tim Conner | last post: by
7 posts views Thread by bill tie | last post: by
20 posts views Thread by jeevankodali | last post: by
10 posts views Thread by igor.kulkin | last post: by
4 posts views Thread by Henrik Dahl | last post: by
15 posts views Thread by morleyc | last post: by
16 posts views Thread by Mark Chambers | last post: by
14 posts views Thread by ohmmega | last post: by
6 posts views Thread by Phil Barber | last post: by
reply views Thread by rainxy | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.