如何找出为什么JavaScript是下载这么慢? [英] How to find out why Javascript is downloading so slowly?

查看:119
本文介绍了如何找出为什么JavaScript是下载这么慢?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个ASP.NET MVC项目,该项目运行糖蜜缓慢。我在一个特定的电话打通小提琴手,发现几个电话,其中有改进的空间很大,至少可以说:

I have an ASP.NET MVC project, which is running as slow as molasses. I opened up Fiddler on one particular call, and found several calls where there's a lot of room for improvement, to say the least:

蓝线我的理解是我的控制器通话,我明白的地方去优化的东西。但是,我看到一堆绿线(我假设,这就意味着JavaScript),而那些也采取了heckuva长的时间。我必须假设jQuery和剑道脚本不正常需要4-6秒转一圈,所以必须有东西在我们的项目code是造成缓慢。但是,$如何跟踪按住C $ C需要优化?

The blue lines I understand are calls to my controller, and I understand where to go to optimize that stuff. But I see a bunch of green lines (which I assume means javascript), and those are also taking a heckuva long time. I must assume that jQuery and Kendo scripts don't normally take 4-6 seconds to turn around, so there must be something in our project code that's causing the slowness. But how do I track down what code needs optimization?

编辑:下面@DaggNabbit在评论中指出,是缓慢的,因为这些的Javascript被调用缓存无效化参数,所以他们正在与每一个电话重新下载!但我看不到任何地方在我的code其中我们要明确地添加缓存无效。例如:

@DaggNabbit in comments below points out that the slowness is because these Javascripts are being called with a cachebuster parameter, so they're being downloaded anew with every call! But I can't see anywhere in my code where we're explicitly adding a cachebuster. e.g.:

<script src="@Url.Content("~/Scripts/kendo.web.min.js")"></script>
...
@Scripts.Render("~/bundles/jquery", "~/bundles/jquerymobile")

我真的不是一个UI专家,但我不能看到那里的缓存无效的来源。任何其他的想法?

I'm really not a UI expert, but I can't see where the cachebuster is coming from. Any other ideas?

推荐答案

这@DaggNabbit正确识别的问题是,JavaScript的正在使用缓存无效参数调用。我已邀请他到自己发布答案的正确答案;当他这样做我会给他回答的功劳。

The problem that @DaggNabbit correctly identified is that the javascripts were being called using a cachebuster parameter. I've invited him to post his answer as the correct answer; when he does so I'll give him answer credit.

同时,如果你有兴趣的为什么的正在插入缓存无效,请参见这里

Meanwhile, if you're interested in why the cachebuster was being inserted, see here.

这篇关于如何找出为什么JavaScript是下载这么慢?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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