title: regex performance issues?
body: <p>I have code like shown below which is doing regex comparison, I thought of to optimize the code. When I checked with .net profiler it shows 80 % time here spending, and I checked my regex filter whether any backtracking occurs but nothing wrong in that regular expression side. So this is the existing code</p>
  
  <pre><code>public class TestFilter : SmoothFilter
     {
       public override bool Apply(Team liveEvent)
            {
                     // Apply each individual piece of the filter using the Match method
                     if ((Filter == null) || (Filter.Length &lt;= 0) || Match(Filter, pl.Instance))
                     {
  
            }
  
      private bool Match(string pattern, string inputdata)
      {
          bool vals = Regex.IsMatch(inputdata, pattern, RegexOptions.IgnoreCase);
          return vals;
      }
  }
  </code></pre>
  
  <p>When I googled I saw the link <a href="http://blog.kurtschindler.net/post/regular-expression-performance-comparisons" rel="nofollow noreferrer">http://blog.kurtschindler.net/post/regular-expression-performance-comparisons</a> , mentions best and faster method if you are not taking initial start up time. so I modified my code like shown below. But I moved my systems I don't have any tool to profile, Can any body tell me whether it improve really? this modified code below</p>
  
  <pre><code> static readonly Regex regexForMethod_E = new Regex("pattern", RegexOptions.Compiled);
  
   private bool Match(string pattern, string inputdata)
   {
       bool vals = regexForMethod_E.IsMatch("inputdata");
       return vals;
  }
  </code></pre>
  
  <p><strong>EDIT</strong></p>
  
  <p>I still I don't know how to move regex instantiation inside Match() method</p>