2013-01-21 2 views
1

내 mvc 응용 프로그램에 다중 경로가 있습니다. 내가 응용 프로그램에서 여러 경로를 알고 성능에 나쁜 일이 무엇입니까?mvc, net의 다중 경로

routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); 
      routes.MapRoute(
       "Faq", 
       "Faq/{action}", 
       new { controller = "Faq", action = "Index" } 
       ); 
      routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); 
      routes.MapRoute(
       "PostArchive", 
       "Post/{action}", 
       new { controller = "Post", action = "PostArchive" } 
       ); 
      routes.MapRoute(
       "LogOn", 
       "Account/{action}", 
       new { controller = "Account", action = "LogOn" } 
       ); 
      routes.MapRoute(
       "Localization", 
       "{lang}/{controller}/{action}/{id}", 
       new { controller = "Home", action = "Index", id = UrlParameter.Optional, lang = UrlParameter.Optional } // Parameter defaults 
       ); 

      routes.MapRoute(
       name: "Default", 
       url: "{controller}/{action}/{id}/{Name}", 
       defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional, name = UrlParameter.Optional }, 
       namespaces: new[] { "MVCTemplateProject.Controllers" } 
       ); 

      routes.MapRoute(
       name: "Post", 
       url: "{lang}/{controller}/{action}/{id}/{Title}", 
       defaults: new { controller = "Post", action = "Index", id = UrlParameter.Optional, Title = UrlParameter.Optional }, 
       namespaces: new[] { "MVCTemplateProject.Controllers" } 
       ); 

답변

1

Sam Saffron wrote an interesting blog article 라우트 성능 - 특히 정규 표현식 제한 조건을 사용하는 라우트 및 라우트 순서. 명확하게 읽을만한 가치가 있습니다. 특히 상대적으로 구현하기 쉬운 기술로 구현 한 성능 향상을 고려할 때 더욱 그러합니다.

1

아니요, 경로 확인이 빠르고 효율적입니다.

대부분의 사이트에는 경로가 거의 없거나 하나만 있습니다.

다른 사이트에는 30 개 이상의 경로가 있습니다. 내 경험에 비추어 볼 때 30 개의 별개의 경로가있는 사이트는 성능면에서 눈에 띄는 지연이 없습니다.