使用Javascript include检索JSON,为什么JS下载和JS执行开始所需的时间不同
我正在对 Web 应用程序进行优化,其中我获取 JSON 格式的列表数据,大小高达 1000 个包含 100 个属性的对象。 eval 过去需要花费大量时间来解析这些大数据。因此,在研究了互联网和 stackoverflow 一段时间后,我得到了另一种从服务器“动态 Javascript include”检索 JSON 数据的方法。
Javascript include 的 JSON 解析速度非常快,如博客中所述。(通过 fiebug 中的控制台日志进行验证)。但是 Javascript 完成下载和执行脚本之间的时间存在差异,并且高达 6 到 7 秒。 知道为什么会发生这种情况以及有什么方法可以解决这个问题吗?
I am doing optimization of web app, where I get list data in JSON format in as large size as 1000 objects containing 100s of attributes. eval used to take lot of time to parse this large data. So after digging internet and stackoverflow for some time I got another way of retrieving JSON data from server 'Dynamic Javascript include'.
Javascript include does JSON parsing very fast, as stated in blogs.(verified with console logs in fiebug). But there is difference between the time Javascript has finished downloading and execution of the script, and huge one as high as 6 to 7 sec.
Any idea, why this is happening and any ways to resolve this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在这里回答我自己的问题,经过更多的挖掘,我发现这个问题只能在我的机器上复制,而在其他机器上,上述过程之间的差异非常小,所以猜测这可能是因为太多的 Firefox 插件而发生的我用过。
只是一个猜测。还不确定。
Answering my own question here, After more digging I found out that the problem was only replicable on my machine, And on others machine the difference between the mentioned process was very less, So guessing that this may be happening because of too many Firefox addons that I have used.
Just a guess work. not sure yet.