Is RegEx.Match much slower in IIS compared to the development server (Cassini)?

When looking at the performance of an asp.net application (webservice), we noticed that in IIS it is much slower (38 seconds) than on the Dev server (18 seconds). Starting the performance profiler (in fetch mode) of Visual Studio, we noticed that the difference is caused by regex.Match ?! In IIS, it takes 70% of the time, while the same tests against the same application in the dev server, it takes less than 1% of the total time.

So, can anyone explain this strange difference in behavior between IIS and Dev Server ??? I already tried things with different application pool settings ... but nothing helped

+6
source share
1 answer

Found it!

It seems that IIS works in 64-bit mode (and casinni is probably 32-bit). By switching the application pool to use 32 bits, it also works fast in IIS, returning it back to 64 bits, and it is slower again.

When searching on a slow 64-bit + regular expression, I also found that people already found this in 2006, and also that it should have been fixed in 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 am using .NET 4.0, so I would not expect this problem to still exist ...

(In stackoverflow also see: slow slowdown in Windows Server 2008 )

BTW if I do not use RegexOptions.Compiled when creating a regular expression, it also works fast on 64 bits. But I need to do some benchmarking to see that the effect of compiling it is 32 bits.

+5
source

Source: https://habr.com/ru/post/919866/


All Articles