This article mainly introduces the page load JS and performance analysis methods, the need for friends can refer to the
First, load the static page to load the reference JS file, and then find the reference file contains the OnLoad function, For example, Main.js contains the onload function, in the main.js to find whether there is a reference to other JS files, the priority to load reference JS file, the file is referenced in the order of loading and main.js in the same order. When the load is complete, the onload function is started. Because the order of JS execution is sequential, in order to improve the speed of the page, the general practice is in the onload only painting pages, some event binding function, Ajax methods can be deferred writing. Second, response speed Analysis 1. Tools to analyze the major browser developer tools (favorite use of Firefox) can easily view the various JS files, HTML files, CSS files and pictures of the loading and execution time. 2. Hard code Analysis in the first step we can basically locate the bottleneck JS file, in the bottleneck JS, you can use Console.time (' Test ') and console. The Endtime (' test ') statement takes the execution time of the JS function and the code block. However, the console statement is only valid in non-IE browsers, and an error is available under IE. If you prefer to use IE, use a timestamp. In the pinch, the more convenient way is to directly pinch the entire JS file, and then use the Firefox browser, press F12 can be seen in the console in the target JS all functions and code block time consuming, you can locate the bottleneck code.