查找:DisplayTemplates速度 [英] Find: DisplayTemplates Speed

查看:104
本文介绍了查找:DisplayTemplates速度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在新的MVC4站点上安装了Mini-Profiler,并注意到某些Find: DisplayTemplates的等待时间很长,其中包括String和DateTime.下面是一个例子.在另一个问题中,萨姆·萨弗隆(Sam Saffron)谈到了查找步骤

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

有什么想法吗?

修改

我设置了4个区域,所以我发现它遍历了所有目录以寻找匹配项,因此我删除了2个区域并具有相同的行为.

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.

推荐答案

一旦我在<head>中的包周围放置了一个概要分析块,便可以看到实际花费的时间.最初,Mini-profiler误导了我:时间不是花在DisplayTemplates/String上,而是花在了其他地方!

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!

就我而言,延迟发生在MVC4 RC的脚本捆绑中.

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

我拿走了捆绑包,一切都很好.

I removed the bundles and all is good.

请参阅以下相关问题:

MVC4 RC脚本捆绑非常慢

这篇关于查找:DisplayTemplates速度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆