RegEx.Match是在IIS中慢得多相比,开发服务器(卡西尼)? [英] RegEx.Match is much slower in IIS compared to Development Server (Cassini)?

查看:471
本文介绍了RegEx.Match是在IIS中慢得多相比,开发服务器(卡西尼)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在注视一个asp.net(Web服务)的应用程序的性能,我们注意到,在IIS它会非常慢(38秒),比开发服务器(18秒),上。 运行,我们注意到差异呼吁regex.Match的Visual Studio性能分析器(采样模式)?在IIS它走的70%的时间,运行针对在开发服务器相同的应用程序相同的测试,它走的总时间不超过1%。

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.

所以,任何人都可以解释这种奇怪的行为差异IIS和开发服务器之间的??? 我已经尝试过的东西有不同的应用程序池设置......但没有任何帮助。

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

推荐答案

找到了!

这似乎是因为IIS是(可能和casinni 32位)运行它在64位。通过切换应用程序池使用32位,这也快于IIS,重新回至64位,这是慢了。

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.

通过搜索64位+正则表达式慢,我还发现,人们已经发现了这个在2006年,也即它应该在.NET 2.0(见被固定在一个SP:<一href="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" rel="nofollow">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)

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)

不过我用.NET 4.0,所以我也不会预期仍然存在这个问题...

However I use .NET 4.0, so I would not have expected that issue to still exist...

(在计算器另见:正则表达式的Windows Server 2008 慢)

(On stackoverflow see also: Regex slow on Windows Server 2008)

B.T.W。如果我做的不要使用 RegexOptions.Compiled 创建正则表达式时,它的执行速度快于64位。但我需要做一些基准测试,看看有什么不编译它的作用是在32位。

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.

这篇关于RegEx.Match是在IIS中慢得多相比,开发服务器(卡西尼)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆