This is from the BCL Team Blog:
Developers using System.Text.RegularExpressions.Regex with the RegexOptions.Compiled flag may notice performance degradation in their 2.0 apps when running on 64-Bit .NET Framework 2.0.
The performance problem occurs in the Regex(String pattern, RegexOptions options) constructor when instantiating very large, un-optimized regular expressions and while specifying the RegexOptions.Compiled flag
There is a hotfix available here, and the hotfix will be rolled into .NET Framework 2.0 SP 1.
The blog post also suggests some workarounds:
-
Reduce the Regular Expression Pattern
-
Use Regex Pre-Compilation Instead of Compiling-on-the-Fly
-
Remove the RegexOptions.Compiled Flag From Your Code