JavaScript 对网页整体性能的影响
在网络上使用 JavaScript 随机获取一个网页。有没有关于 JavaScript 在全局加载/执行时间中所占份额的数据? 我的意思是,如果这个份额接近 0%,那么优化 JavaScript 解释器就没有任何好处,众所周知,你可以通过快速解释器赚一些钱:) 我猜像 Google 和 Mozilla 这样的公司有这样的数字,但我找不到它们。
有人可以给我指一些数字吗?
提前致谢
Take a random web page with JavaScript on the web. Are there any numbers on what the share of JavaScript is on the global load/execution time?
I mean, if that share would be close to 0%, there would be no benefit in optimizing the JavaScript interpreter, nut as we all know, you can make some money with a fast interpreter :)
I guess companies like Google and Mozilla have such numbers, but I couldn't find them.
Can someone point me to some numbers?
thanks in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
性能:分析不同网站如何使用浏览器子系统
将它们整合在一起
分析新闻网站
分析顶级 AJAX 站点
Performance: Profiling how different web sites use browser subsystems
Bringing It All Together
Profiling News Sites
Profiling Top AJAX Sites
对于大多数网页,JavaScript 仅在初始“准备”过程中增加极少量的执行时间。事实上,它甚至可以在图像等下载之前完成执行。所以,是的,JavaScript 对整体初始加载/执行时间的影响通常接近于零。
我没有你想要的数字,但如果我有,我认为它们会表明 JavaScript 的执行速度并不重要。
但这很重要。初始加载/执行时间并不是全部。
过去,提高网页速度的关键在于缩短输入 URL 与页面呈现并可供使用之间的时间。是的,JavaScript 对这一小段时间(在大多数网站上)并没有产生重大影响,因此浏览器供应商并没有太担心它。 JavaScript 引擎非常慢,但这并不重要。
现在,越来越多的网页正在成为富客户端应用程序,页面随着用户的点击和移动而变化,而这一切都是由 JavaScript 处理的。对于这样的应用程序,更快的 JS 引擎可以让整个体验感觉更快,而不仅仅是初始加载。普遍的共识是,这种趋势将会持续下去;许多人预测,在大多数任务中,Web 应用程序将比桌面应用程序更受欢迎。
这就是为什么浏览器供应商现在在 JavaScript 引擎上如此努力,以更快地处理当今的 JS 密集型 Web 应用程序(以及明天的 JS 密集型 Web 应用程序)。但这是一种你无法轻易用秒来衡量的“更快”。
For most web pages, the JavaScript adds only a tiny amount of execution time to the initial "getting ready" process. In fact, it can complete its execution before images etc. have even downloaded. So yes, the impact of JavaScript on the overall initial load/execution time is often close to zero.
I don't have the numbers you're asking for, but if I did, I think they would indicate that JavaScript execution speed isn't important.
But it is important. Initial load/execution time isn't the whole story.
In the past, making web pages faster was all about reducing the time between the moment you enter the URL and the moment the page is rendered and ready to use. And yes, JavaScript doesn't have a major impact on this little piece of time (on most websites), and thus the browser vendors didn't worry about it too much. JavaScript engines were extremely slow, and it didn't matter much.
Now, more and more web pages are becoming rich client-side applications, with the page changing in response to the user's clicks and movements, and all this is handled by JavaScript. With applications like these, a faster JS engine makes the whole experience feel faster, not just the initial load. And the general consensus is that this trend will continue; many predict that web applications will become more popular than desktop applications for most tasks.
That's why the browser vendors are now working so hard on their JavaScript engines – to handle today's JS-heavy web apps (and tomorrow's even-more-JS-heavy web apps) faster. But it's a kind of "faster" that you can't easily measure in seconds.