ASP.NET MVC 3 Razor performance

本文对比了ASP.NET MVC 2与MVC 3使用ASPX和Razor视图引擎时的性能表现。结果显示,在测试环境下Razor视图引擎的请求处理速度明显低于ASPX。作者对测试过程进行了详细说明,并分享了Scott Guthrie对此现象的解释。

 

I've made a simple hello world project in asp.net mvc2,3 aspx and 3 razor and benchmarked them. What I see is:

asp.net mvc 2 aspx : 4200 request per second

asp.net mvc 3 aspx beta 1: 3200 request per second

asp.net mvc 3 razor beta 1: 1700 request per second

What's wrong with razor, it's so slow?

Update: I've redone the test. All 4 test virtual directories uses the same .net 4 integrated mode app pool. All projects are done with add new empty x project and adding 1 page with 1 line text and with no code. all sites are compiled in release mode. My system is windows 7, 4 gb i7 4 cores. I've run the test 2 times to warm up iis and these are second run results. apache bench parameters : ab -n100000 -c1000 results:

asp.net 4 - rps: 4780 cpu: %43

mcv 2 - rps: 4322 cpu: %58

mvc 3 beta 1 aspx - rps: 2324 cpu: %54

mvc 3 beta 1 razor - rps: 1615 cpu: %54

Update 2 Scott Guthrie answered in his blog:

We haven't fully optimized MVC3 yet (there is usually a lot of cache tuning we do). We expect razor to be the same performance as the .aspx view engine before it is finally released.

Update 3 Release Candidate 1 benchmark:

mvc 3 rc1 razor - rps: 1960 cpu: %54

Update 4 Release Candidate 2 benchmark:

mvc 3 rc2 razor - rps: 2187 cpu: %54

mvc 3 rc2 aspx - rps: 4014 cpu: %58

 

 

以上是一个测试结果来自国外网站,以下是回复内容,期待MVC3变得更好吧。

 

How did you perform the benchmark? Was your site deployed on IIS in mode Release? Did you use the <deployment retail="true" /> section in your machine.config? Also remember that ASP.NET MVC 3 is still under heavy development so you cannot expect it to be fully optimized yet. At least wait until it hits RTM.

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值