I run into this article:
Performance: Compiled vs. Interpreted Regular Expressions, I modified the sample code to compile 1000 Regex and then run each 500 times to t
This is almost certainly an indication that your benchmark code is written incorrectly vs. compiled regex's being slower than interpreted ones. There is a lot of work that went into making compiled regex's performant.
Now that we have the code can look at a few specific things that need updating
lock
used at all? It's completely unnecessaryStopWatch
not DateTime
Regex
and single non-compiled Regex
matching N times. Not N of each matching at most once per regex.