What exactly is MVC3 doing during what mini-profiler calls the Find: Index step?

709 Views Asked by At

Out of the box, mini-profiler added to an MVC3 site reports a step called Find: Index, where Index is the viewName parameter set in the controller's call to View(). The first time a view is hit this step can easily take over a second, then it's negligible for all subsequent calls.

What's going on here? I assume that mini-profiler is guilty of poorly choosing or adopting the name for this step because it surely can't take a second to find anything, certainly specifying the view's full file path and name doesn't make any difference, so it's not find in that sense. Setting MvcBuildViews true doesn't help either.

1

There are 1 best solutions below

0
On

I blogged about this here: http://samsaffron.com/archive/2011/08/16/Oh+view+where+are+thou+finding+views+in+ASPNET+MVC3+

The "find" step will include the "view compilation phase" during the first run. On subsequent runs it is lightning fast (unless you have something really bad going on). Also note that it is even faster when running in non-debug.

You can avoid this hit by pre-compiling views, something I would not recommend due to the complexity it introduces.