[Mono-dev] Performance of compiled regular expressions?
earlz at lastyearswishes.com
Mon Dec 3 02:20:52 UTC 2012
So, I recently did a major update to my ASP.Net website running on
Mono (runs on .Net as well, but I work on it and host it with Mono).
Long story short, my websites performance sunk big time. It now takes
110ms for a response that once took less than 20ms.
I traced down the big difference to using regular expressions as a
part of my routing and a few other things. (I have a custom MVC
Here are some(maybe all) of the regular expressions being used
(they're really simple):
All of these regular expressions are compiled once at application
startup and cached. (with RegexOptions.Compiled). They are used with
with IsMatch(input) or Replace(input, replacement);
When profiling my application however, the number one most time
consuming method was `System.Text.RegularExpressions.Interpreter:Eval
database functions, which are also not really fast didn't even compare
to the amount of time this function consumed)
Is there anything I can do to mitigate this problem? I'm using the
latest stable version of Mono (Arch Linux) on a 64-bit platform. Is it
true also that regular expression should now be on par with .Net's
implementation? From what I understand, mono compiles them to IL
correct? Is there anything to watch for in regular expressions that
could give me performance problems like this?
More information about the Mono-devel-list