While looking at the performance of an asp.net (webservice) application, we noticed that on IIS it is much slower (38 seconds) than on the Dev Server (18 seconds). Running the Performance profiler (in sampling mode) of Visual studio we noticed the difference is calling regex.Match?! In IIS it is taking 70% of the time, running the same test against same app in dev server, it is taking less than 1% of the total time.
So anyone can explain this weird difference in behaviour between IIS and Dev Server??? I already tried stuff with different application pool setting... but nothing helped
Found it!
It seems to be because IIS is running it in 64 bit (and casinni probably in 32 bit). By switching the application pool to use 32 bit, it is also fast in IIS, resetting it back to 64 bit and it is slow again.
By searching on 64 bit + regex slow, I also found that people already found this in 2006, and also that it was supposed to be fixed in a sp on .NET 2.0 (see: http://blogs.msdn.com/b/bclteam/archive/2007/05/21/the-regexoptions-compiled-flag-and-slow-performance-on-64-bit-net-framework-2-0-josh-free.aspx)
However I use .NET 4.0, so I would not have expected that issue to still exist...
(On stackoverflow see also: Regex slow on Windows Server 2008)
B.T.W. if I do not use the RegexOptions.Compiled
when creating the regex, it also performs fast on 64 bit. But I need to do some benchmarking to see what the effect of not compiling it is on 32 bit.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With