New JavaScript techniques for rapid page loads 加快页面载入的新js技术

Speed has always been one of Chrome‘s primary missions, ever since it was included as one of the founding principles in 2008. But speed is about more than just traditional Javascript benchmarks. Ideally every part of a user‘s interaction with a browser is fast, starting with loading web pages. Chrome is introducing two techniques called script streaming and code caching designed to reduce that painful waiting time spent staring at a white screen, especially on mobile devices.

速度一直是chrome的首要任务,在2008年它被确定为一条基本原则。chrome引入了两种技术:脚本流和代码缓存。来减少等待时间。

Script streaming optimizes the parsing of JavaScript files. Previous versions of Chrome would download a script in full before beginning to parse it, which is a straightforward approach but doesn‘t fully utilize the CPU while waiting for the download to complete. Starting in version 41, Chrome parses async and deferred scripts on a separate thread as soon as the download has begun. This means that parsing can complete just milliseconds after the download has finished, and results in pages loading as much as 10% faster. It‘s particularly effective on large scripts and slow network connections.

脚本流优化了js文件的解析。从42版开始,在下载开始时,chrome在单独的线程上解析异步和递延脚本。这意味着,当下载完成后的千分之一秒,解析即可完成。

Code caching is another new technique that helps speed up page loading, specifically on repeated visits to the same page. Normally, the V8 engine compiles the page’s JavaScript on every visit, turning it into instructions that a processor understands. This compiled code is then discarded once a user navigates away from the page as compiled code is highly dependent on the state and context of the machine at compilation time. Chrome 42 introduces an advanced technique of storing a local copy of the compiled code, so that when the user returns to the page the downloading, parsing, and compiling steps can all be skipped. Across all page loads, this allows Chrome to avoid about 40% of compile time and saves precious battery on mobile devices.

代码缓存也可以提高页面载入速度,特别是反复访问同一个页面时。

时间: 2024-11-10 18:32:05

New JavaScript techniques for rapid page loads 加快页面载入的新js技术的相关文章

How a web page loads

The major web browsers load web pages in basically the same way. This process is known as parsing and is described by the HTML5 specification. A high-level understanding of this process is critical to writing web pages that load efficiently. Parsing

how to add Javascript and CSS in page layout with sharepoint 2013

how to add Javascript and CSS in page layout with sharepoint 2013 Sometimes, we need create a custom page layout, at the time, if we want to add some javascript and css code, how to do it? we cannot add the code in page layout file directly, the syet

javascript refresh page 几种页面刷新的方法

Javascript刷新页面的几种方法:1    history.go(0) 2    location.reload() 3    location=location 4    location.assign(location) 5    document.execCommand('Refresh') 6    window.navigate(location) 7    location.replace(location) 8    document.URL=location.href 自动

【转】javascript弹出固定大小的窗口页面

来源:http://weicfprince.blog.163.com/blog/static/8441066920081010113231969/ 现在我们想弹出一个WEB窗体,让其处于屏幕的中间位置,并设置其固定大小,固定外观显示.我们可以在一个JS文件中写这样一个函数: //弹出固定大小固定位置固定外观的新窗口 function OpenWindow(url,w,h) { var left=Math.round((window.screen.availWidth-w)/2); var top

sharepoint 2013 自定义列表查看页面附件打开新页面方法 dispform attachments open new page

我们在sharepoint的列表中,打开某一条数据,如果那条数据有附件,打开附件的时候,总是会把当前的页面给替换掉.如何在点击附件的时候,打开新页面,可以用一下一段脚本来处理. <script> $(document).ready(function () { if ($("#idAttachmentsTable") != null) { $('#idAttachmentsTabletbody tr td').each(function () { var href = $(t

javascript异步延时加载及判断是否已加载js/css文件

引用就是某一变量(目标)的一个别名,对引用的操作与对变量直接操作完全一样. 引用的声明方法:类型标识符 &引用名=目标变量名: 例如: int a int &b=a; //定义引用b,它是变量a的引用,即别名 #include <stdio.h> void main() { int a = 123; int &b = a; printf("a=%d b=%d\n", a, b); } 执行结果: 实例:引用和变量的关系 #include <io

ArcGIS API for JavaScript 4.2学习笔记[0] AJS4.2概述、新特性、未来产品线计划与AJS笔记目录

放着好好的成熟的AJS 3.19不学,为什么要去碰乳臭未干的AJS 4.2? 诸君,我喜欢嫩的--呸呸呸 诸君,我喜欢3D咋了?新事物会替代旧事物不是~ ArcGIS API for JavaScript 4.2概述 AJS 4.2,即ArcGIS API for JavaScript 4.2,是美国ESRI公司针对WebGIS市场推出的.利用JavaScript和Dojo开发的一款产品,它在2016年12月发布.而AJS 4.0 beta则在一年前就发布了. 关于AJS3和AJS4选择的问题,

加快页面呈现,留住用户!

加快页面的呈现对于提升用户体验非常重要,良好的用户体验可以帮助我们获得更多的用户的信赖,从而在竞争中占得先机. 页面加载速度对用户的影响如何? 根据 Akamai 和Forrester的调查研究,接近一般的web使用者希望页面能在2秒以内打开,如果超过3秒大多数用户会放弃等待转向其他网站.尤其是对于购物网站,有79%的用户会因为网站速度慢而不再光临,甚至接近一办的人会把这个糟糕的体验在他的朋友圈传播开.网站的加载速度同时也会影响SEO. 如何改善页面加载速度?  优化的技巧很多,下面会逐一列出并

JSP基础 指令page errorPage 当前页面抛出异常,转发到指定页面

礼悟:    好好学习合思考,尊师重道存感恩.叶见寻根三返一,江河湖海同一体.          虚怀若谷良心主,愿行无悔给最苦.读书锻炼强身心,诚劝且行且珍惜. javaEE:7                  javaSE:1.8          JSTL:1.2.2        server:tomcat 8.5    browser:Chrome/Firefox             os:windows7 x64            ide:MyEclipse 2017 My