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. springboot项目打war包部署到服务器(eclipse & gradle环境)

    1.右键项目run as  -> run configurations,打开Run configurations弹出框 2.右键Gradle Project -> New Configur ...

  2. hdu 4462 第37届ACM/ICPC 杭州赛区 J题

    题意:有一块n*n的田,田上有一些点可以放置稻草人,再给出一些稻草人,每个稻草人有其覆盖的距离ri,距离为曼哈顿距离,求要覆盖到所有的格子最少需要放置几个稻草人 由于稻草人数量很少,所以状态压缩枚举, ...

  3. Codeforces Round #360 (Div. 2) D. Remainders Game 数学

    D. Remainders Game 题目连接: http://www.codeforces.com/contest/688/problem/D Description Today Pari and ...

  4. SGU 404 Fortune-telling with camomile

    404. Fortune-telling with camomile Time limit per test: 0.25 second(s)Memory limit: 65536 kilobytes ...

  5. ROS知识(8)----CMakeLists.txt文件编写的理解

    ROS(Indigo)编程必须要理解CMakeList.txt的编写规则,教程地址:catkin/CMakeLists.txt,官网有相关的教程,中文的翻译版本写的很不错,教程地址:ROS中的CMak ...

  6. vim segment fault when i upgrade to macOS Mojave 103_PollServerReady

    系统升级到 macOS Mojave, vim插件YouCompleteMe出错. Vim: Caught deadly signal SEGV Error detected while proces ...

  7. MVC路由之浅见

    1.定义路由.路由规则 public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute("{re ...

  8. java多线程知识点汇总(一)多线程基础

    1.什么叫多线程程序? 答:一个进程至少有一个线程在运行,当一个进程中出现多个线程时,就称这个应用程序是多线程应用程序. java编写的程序都是多线程的,因为最少有俩线程,main主线程和gc线程. ...

  9. spring mvc Controller中使用@Value无法获取属性值

    在使用spring mvc时,实际上是两个spring容器: 1,dispatcher-servlet.xml 是一个,我们的controller就在这里,所以这个里面也需要注入属性文件 org.sp ...

  10. ExtJS GridPanel的ColumnModel 动态加载

    var colM = "company,id,flyline"; var colMArr = colM.split(","); var colLength = ...