Performance of ASP.NET MVC routing
Does anyone know, is routing processing time valuable in a comparison with the total request time? Will there be a large performance difference between an application with 20 and 100 (probably more) routings? Will be grateful for a link with the routings mechanism description.
Take a look here. Please note that this is an old answer from 2008, but I would guess it still holds true. In particular note the bit about using named routes.
In other words, if you know which route you will be using, then you can jump straight to the correct route with code like this: RedirectToRoute("routeName", viewData);
and it won't waste time trawling through routes until it finds the correct one. This may seem a bit cumbersome, but it's better than hardcoding the routes as, if you change the way of generating your routes, this code will still work, whereas a hard coded route would break.
I would venture to say no, the time is insignificant compared to the overall processing time of the request in most scenarios.
There are a lot of variables that might be worth considering if you are going to benchmark this. For example, how simple/complex are those routes? Do they have constrains with regex on them? et cetera.
链接地址: http://www.djcxy.com/p/8124.html上一篇: 在asp.net中的DateTime JavaScript序列化没有给出一个JavaScript日期对象?
下一篇: ASP.NET MVC路由的性能