Important update: see update 5 below, there is no performance problem in asp.net mvc 3, this is a test problem
I made a simple hello world project in asp.net mvc2,3 aspx and 3 razors and compared them. I see:
System Requests per second ------------------------------------------- asp.net mvc 2 ASPX 4200 asp.net mvc 3 Beta 1 ASPX 3200 asp.net mvc 3 Beta 1 Razor 1700
What's wrong with a razor, is it so slow?
Update: I redid the test. All 4 test virtual directories use the same .net 4 application pool with integrated mode. All projects are carried out with the addition of a new empty x-project and the addition of 1 page with 1 string text and without code. all sites are compiled in release mode. My system is windows 7, 4 gb i7 4 cores. I tested the test 2 times to warm up iis and these are the results of the second run. Apache scanner options: ab -n100000 -c1000 Results:
System Requests per second CPU Utilization ---------------------------------------------------- asp.net 4 4780 43% mcv 2 4322 58% mvc 3 beta 1 aspx 2324 54% mvc 3 beta 1 razor 1615 54%
Update 2 Scott Guthrie replied on his blog:
We have not fully optimized MVC3 (usually we often tune the cache). We expect the razor to be the same performance as the .aspx viewer before it is finally released.
System Requests per second CPU Utilization ---------------------------------------------------- mvc 3 rc1 razor 1960 54% mvc 3 rc2 razor 2187 54% mvc 3 rc2 aspx 4014 58%
Update 5 all tests performed in release mode, but the problem was debug="true" in my web.config file (which also affects the release of assemblies), after changing it to false, the fix is fixed. And it is interesting how this affects only the razor templating on this scale. It should be in our minds when deployed.
System Requests per second CPU Utilization ---------------------------------------------------- mvc 3 rc2 razor 3940 58% mvc 3 rc2 aspx 4100 58%
Thanks to the asp.net mvc team, great job!
performance c # asp.net-mvc asp.net-mvc-3 razor
sirmak Sep 30 '10 at 8:28 2010-09-30 08:28
source share