[Javascript]2. Improve you speed! Script Execution
Let's take a closer look at how a browser retrieves and acts on scripts.
modern browser can parallel downloading 6 files(style sheets && images)
at a time. BUT, when it see Scripts, the parallel downloading will stop!
Therefore, any scripts in <head></head> which are not that necessary to be there
might affect you browser performance
1. Scripts that are not essential to immediate loading of the page should be
moved as low as possible, in front of </body>
2. With external files, the HTML5 async attribute will allow the rest of the
page to load before the script runs.
When browser loading page, once see async attribute,
it will now fetch the script resource, but will continue parsing and rendering
HTML, without waiting for the script to complete!
<script src="formOjbect.js" async></script>
-----------------------------Ex------------------------------
"Be careful, for data intensive processes are the ones that will stop the show. Which of these included script tags will take the longest to load"
inhabitants.js
var invertedPeninsula = {
inhabitants: [
"Nipping Global Variable",
"Sneaky For-in",
"Bulging Blocking Script"
]
} function populationGetter(){
var population = invertedPeninsula.inhabitants;
var list = ""; for(var i = 0, ff = population.length; i < ff; i++){
list += (population[i] + " ");
}
return list.trim();
} populationGetter();
info.js
var land = "Inverted Peninsula";
var character = "Dhuun";
var lampsLit = 1;
inhabitantsProto.js
Array.prototype.killTheInsolent = function(){};
Array.prototype.countPopulace = function(){};
Array.prototype.countUndeadPopulace = function(){};
Array.prototype.incesticide = function(){};
Array.prototype.shadowProvider = function(){};
[Javascript]2. Improve you speed! Script Execution的更多相关文章
- [Javascript]3. Improve you speed! Performance Tips
/** Let inheritance help with memory efficiency */ function SignalFire(ID, startingLogs){ this.fireI ...
- [Javascript]1. Improve you speed! Loop optimaztion
/** Improve you loop code */ var treasureChest = { goldCoins: 10000, magicalItem : "Crown of Sp ...
- 【JavaScript性能优化】------理解Script标签的加载和执行
1.script标签是如何加载的?当浏览器遇到一个 < script>标签时,浏览器会停下来,运行JavaScript代码,然后再继续解析.翻译页面.同样的事情发生在使用 src 属性加载 ...
- javaScript中的小细节-script标签中的预解析
首先介绍预解析,虽然预解析字面意思很好理解,但是却是出坑出的最多的地方,也是bug经常会有的地方,利用好预解析的特性可以解决很多问题,并且提高代码的质量及数量,浏览器在解析代码前会把变量的声明和函数( ...
- 完整的JavaScript包括三部分、script标签、JavaScript的基本语法以及变量和字面量的关系
完整的JavaScript包括三大部分: -ECMAScript JavaScript的开发规范:提供核心语言功能 -DOM document object model 文档对象模型:提供 ...
- Increase PHP script execution time with Nginx
If you have a large WordPress setup or a server with limited resources, then you will often see the ...
- unity 脚本执行顺序设置 Script Execution Order Settings
通过Edit->Project Settings->Script Execution Order打开MonoManager面板 或者选择任意脚本在Inspector视图中点击Execu ...
- Unity3D Script Execution Order ——Question
我 知道 Monobehaviour 上的 那些 event functions 是 在主线程 中 按 顺序调用的.这点从Manual/ExecutionOrder.html 上的 一张图就可以看出来 ...
- JavaScript之<script>标签简介
向html页面中插入JavaScrpt的主要方法,就是使用<script>元素,下面是Html 4.01为<script>定义的6个属性. 1.async:可选表示应该立即下载 ...
随机推荐
- android setContentView
韩梦飞沙 韩亚飞 313134555@qq.com yue31313 han_meng_fei_sha setContentView 这个 就是 设置内容视图. 装饰视图 DecorView ...
- [51Nod 1773] A国的贸易
[51Nod 1773] A国的贸易 题目描述 A国是一个神奇的国家. 这个国家有 2n 个城市,每个城市都有一个独一无二的编号 ,编号范围为0~2n-1. A国的神奇体现在,他们有着神奇的贸易规则. ...
- 【干货】PHP常见危险函数
passthru() 功能描述:允许执行一个外部程序并回显输出,类似于 exec(). 危险等级:高 exec() 功能描述:允许执行一个外部程序(如 UNIX Shell 或 CMD 命令等). 危 ...
- eclipse转idea, 快捷键设置
设置快捷键的途径: 打开idea的配置,找到Keymap,设置为eclipse 另外还要手动设置某些快捷键 上下移动 点击类打开 代码提示 查询 重命名 快速实现接口 回到上一次光标处
- ACdream 速攻组~
1007 a + b /*这题就是一个快速幂,但是十分猥琐的是,模是1e10 + 7,不是1e9 + 7,这就产生了一个爆long long的问题.所以要对快速幂中的乘法操作进行一下改造.请教了BIT ...
- 使用邮件和RSS两种方式,订阅博客更新通知
分类: 系统运维 点击订阅按钮,可以订阅本博客的更新 输入您的邮件地址,可以订阅本博客的更新通知,及时了解最新内容 使用RSS,订阅-马二进三名人传记-博客 也许大家是第一次听到RSS这个概念,那什么 ...
- 【spark系列3】spark开发简单指南
分布式数据集创建之textFile 文本文件的RDDs能够通过SparkContext的textFile方法创建,该方法接受文件的URI地址(或者机器上的文件本地路径,或者一个hdfs ...
- mklink让网盘同步不同文件夹
mklink简介 Linux 下有一个叫符号链接的东东,是 ln 这个链接命令,mklink 和 ln 的功能几乎一样.在xp系统下,junction命令要用微软开发的小程序 junction.exe ...
- TASKER 手机在有同一个号码的三个未接电话时自动回复短信
http://tieba.baidu.com/p/3695018030 感谢默默为Tasker吧奉献的人! 配置为>未接来电 任务为>代码>javascriptlet 代码为: va ...
- 四种DCOM错误的区别,0x80080005 0x800706be 0x80010105 0x
四种DCOM错误的区别Differences between the following DCOM error 0x800800050x800706be0x800101050x800706ba ...