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的更多相关文章

  1. [Javascript]3. Improve you speed! Performance Tips

    /** Let inheritance help with memory efficiency */ function SignalFire(ID, startingLogs){ this.fireI ...

  2. [Javascript]1. Improve you speed! Loop optimaztion

    /** Improve you loop code */ var treasureChest = { goldCoins: 10000, magicalItem : "Crown of Sp ...

  3. 【JavaScript性能优化】------理解Script标签的加载和执行

    1.script标签是如何加载的?当浏览器遇到一个 < script>标签时,浏览器会停下来,运行JavaScript代码,然后再继续解析.翻译页面.同样的事情发生在使用 src 属性加载 ...

  4. javaScript中的小细节-script标签中的预解析

    首先介绍预解析,虽然预解析字面意思很好理解,但是却是出坑出的最多的地方,也是bug经常会有的地方,利用好预解析的特性可以解决很多问题,并且提高代码的质量及数量,浏览器在解析代码前会把变量的声明和函数( ...

  5. 完整的JavaScript包括三部分、script标签、JavaScript的基本语法以及变量和字面量的关系

    完整的JavaScript包括三大部分: -ECMAScript   JavaScript的开发规范:提供核心语言功能 -DOM   document object model   文档对象模型:提供 ...

  6. 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 ...

  7. unity 脚本执行顺序设置 Script Execution Order Settings

     通过Edit->Project Settings->Script Execution Order打开MonoManager面板  或者选择任意脚本在Inspector视图中点击Execu ...

  8. Unity3D Script Execution Order ——Question

    我 知道 Monobehaviour 上的 那些 event functions 是 在主线程 中 按 顺序调用的.这点从Manual/ExecutionOrder.html 上的 一张图就可以看出来 ...

  9. JavaScript之<script>标签简介

    向html页面中插入JavaScrpt的主要方法,就是使用<script>元素,下面是Html 4.01为<script>定义的6个属性. 1.async:可选表示应该立即下载 ...

随机推荐

  1. hdu 5288 OO’s Sequence(2015多校第一场第1题)枚举因子

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5288 题意:在闭区间[l,r]内有一个数a[i],a[i]不能整除 除去自身以外的其他的数,f(l,r ...

  2. poj 3164

    朱刘算法 步骤: 1.计算出每个点边权最小的边的权(如果除根以外有其他的点没有入边,则不存在最小树形图),并记下边的另一个端点(称其为这个点的前趋) 2.沿着每个点向上走,如果在走到根或环上的点之前, ...

  3. Mysql的学习随笔day2

    关于输入中文的问题,各种更改完utf8后仍然乱码. 最后找到一种可行的方法:在insert之前,输入 set names 'gbk' 约束保证数据的完整性和一致性.约束分为表级约束和列级约束,前者可以 ...

  4. phalcon Model 'partitions' could not be loaded(模型不支持分区语句)

    注意: 很明确提示用phalcon自带的模型层是不能用partition这个关键字的 解决方法: 自己写个PDO类 然后用pdo中的query方法执行语句成功: mysql分区目的 是减少数据库的负担 ...

  5. python开发_tkinter_菜单选项中英文切换_菜单选项不可用操作_博主推荐

    我使用的python版本为:3.3.2 如果你对python中tkinter模块的菜单操作不是很了解,你可以看看: python开发_tkinter_窗口控件_自己制作的Python IDEL_博主推 ...

  6. 配置主从Mysql

    怎么安装mysql数据库,这里不说了,只说它的主从复制,步骤如下: 1.主从服务器分别作以下操作:  1.1.版本一致  1.2.初始化表,并在后台启动mysql  1.3.修改root的密码 2.修 ...

  7. Vue集成微信开发趟坑:公众号以及JSSDK相关

    首先,类库方面,Vue中引入JSSDK的话,请引入weixin-js-sdk,而不是weixin-jsapi,原因在于weixin-jsapi不是最新版:还要注意JS接口安全域名,不需要http前缀, ...

  8. ARM FPGA Extended Memory Interface

    Connect a ARM Microcontroller to a FPGA using its Extended Memory Interface (EMI) http://elinux.org/ ...

  9. [Asp.net MVC]Html.AntiForgeryToken()

    CSRF(Cross-site request forgery)跨站请求伪造,也被称为“One Click Attack”或者Session Riding,通常缩写为CSRF或者XSRF,是一种对网站 ...

  10. js判断手机端和pc端

    var browser = { versions: function() { var u = navigator.userAgent, app = navigator.appVersion; retu ...