Find: DisplayTemplates Speed

I have a Mini-Profiler installed on the new MVC4 site, and pay attention to the long latency for a specific one Find: DisplayTemplates, including String and DateTime. The following is an example. In another question, Sam Shaffron said this about the search step.

In subsequent runs, it is lightning fast (unless you have something really bad)

But when each page loads, the following happens:

http://localhost:80/SLS.Site/s/hogwarts/lunch...     2.6    +0.0
  Check School Permissions                           2.4    +2.0     1 sql   0.9
  Controller: SchoolAdmin.LunchGroupsController...   4.0    +4.5
  Find: Index                                        0.4    +8.6
  Render : Index                                    70.0    +9.1     2 sql   13.0
   Controller: SchoolAdmin.LunchGroupsController...  2.6    +12.3
   Find: BuildingTree                                0.4    +14.9
   Render partial: BuildingTree                      4.4    +15.4    1 sql   3.2
   Controller: SchoolAdmin.LunchGroupsController...  3.3    +20.2
   Find: Teachers                                    0.6    +23.6
   Render partial: Teachers                          4.3    +24.3    1 sql   2.4
   Find: DisplayTemplates/String                   409.3    +31.9
   Render partial: _UserContext                      0.0    +441.3
   Find: _LoginPartial                               1.2    +441.4
   Render partial: _LoginPartial                     0.2    +442.6
                                                                     3.9 % in sql

Any thoughts?

Edit

I had 4 settings areas, so I decided that it scans all directories looking for matches, so I deleted 2 areas and had the same behavior.

+5
source share
2 answers

<head>, , . - , : , DisplayTemplates/String, !

MVC4 RC script.

, .

. :

MVC4 RC script

+2

... , :

@DisplayFor(x => x.StringProperty);

, DisplayFor/EditorFor , .

( , DisplayFor/EditorFor)

DisplayFor/Editor MVC type Views/ControllerName/DisplayTemplates , , Views/ControllerName/DisplayTemplates/String.cshtml. , Shared/DisplayTemplates views, , .

( - )

, , Display/Editor, ToString() .

String, DisplayFor(x => StringProperty) @Model.StringProperty, , MVC DisplayTemplate , .

+3

All Articles