Search code examples
asp.net-mvcmvc-mini-profiler

Find: DisplayTemplates Speed


I have Mini-Profiler installed on a new MVC4 site and notice a big wait time for certain Find: DisplayTemplates including String and DateTime. Below is an example. In another question, Sam Saffron said this about the find step

On subsequent runs it is lightning fast (unless you have something really bad going on)

But the following happens on every page load:

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 areas setup, so I figured it was traversing all the directories looking for a match, so I removed 2 of the areas and have the same behavior.


Solution

  • Once I put a profiling block around the bundles in the <head> I could see where the time was really being spent. Mini-profiler was misleading me, originally: the time was not spent in DisplayTemplates/String but elsewhere!

    In my case, the delay was happening in MVC4 RC's script bundling.

    I removed the bundles and all is good.

    See related issue below:

    MVC4 RC script bundling very slow