Tech Off Post

Single Post Permalink

View Thread: Poor performance of .NET Regex
  • User profile image

    AdrianJMartin wrote:
    one huge difference is that the body of text you are searching will have been pushed into unmanged memory...

    Not really, as the text is split into lines first in the C# program before matching each line with regex. So I don't think managed/non-managed memory difference comes into play here.

    The only difference in the code was that the initial version used Regex.Match(), and the new version uses PCRE wrapper function to do the same on the same strings using the same regular expression. The surrounding code is absolutely the same. The difference in speed must be in the way regular expressions are implemented in PCRE and .NET.