Home Web Front-end JS Tutorial Introduction to page loading js and performance analysis methods_javascript skills

Introduction to page loading js and performance analysis methods_javascript skills

May 16, 2016 pm 04:54 PM
Performance analysis

1. Load

First load the referenced js file of the static page, and then check whether the referenced file contains the onload function. For example, main.js contains the onload function. Check main.js to see if there are references to other js files. For references, the referenced js files are loaded first, and the loading order of the referenced files is consistent with the order of main.js.
After loading is completed, start executing the onload function. Since the js execution sequence is sequential, in order to improve the page response speed, the general approach is to only draw the page in onload, and some event binding functions, ajax methods, etc. can be written later.

2. Response speed analysis

1. Analyze with the help of tools
The developer tools of major browsers (I like using Firefox the most) can easily view each js file and html file , loading and execution time of css files and images.

2. Hard coding 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.Endtime(' test') statement pinches the execution time of js functions and code blocks. However, the console statement is only valid when executed in non-IE browsers, and an error will be reported under IE. If you prefer to use IE, use timestamps. When pinching, the more convenient method is to pinch the entire js file directly, and then use Firefox browser. Press F12 to see the time consumption of all functions and code blocks in the target js in the console, and you can locate the bottleneck code. at.

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Performance analysis of Kirin 8000 and Snapdragon processors: detailed comparison of strengths and weaknesses Performance analysis of Kirin 8000 and Snapdragon processors: detailed comparison of strengths and weaknesses Mar 24, 2024 pm 06:09 PM

Kirin 8000 and Snapdragon processor performance analysis: detailed comparison of strengths and weaknesses. With the popularity of smartphones and their increasing functionality, processors, as the core components of mobile phones, have also attracted much attention. One of the most common and excellent processor brands currently on the market is Huawei's Kirin series and Qualcomm's Snapdragon series. This article will focus on the performance analysis of Kirin 8000 and Snapdragon processors, and explore the comparison of the strengths and weaknesses of the two in various aspects. First, let’s take a look at the Kirin 8000 processor. As Huawei’s latest flagship processor, Kirin 8000

Performance comparison: speed and efficiency of Go language and C language Performance comparison: speed and efficiency of Go language and C language Mar 10, 2024 pm 02:30 PM

Performance comparison: speed and efficiency of Go language and C language In the field of computer programming, performance has always been an important indicator that developers pay attention to. When choosing a programming language, developers usually focus on its speed and efficiency. Go language and C language, as two popular programming languages, are widely used for system-level programming and high-performance applications. This article will compare the performance of Go language and C language in terms of speed and efficiency, and demonstrate the differences between them through specific code examples. First, let's take a look at the overview of Go language and C language. Go language is developed by G

How to use the php extension XDebug for powerful debugging and performance analysis How to use the php extension XDebug for powerful debugging and performance analysis Jul 28, 2023 pm 07:45 PM

How to use the PHP extension Xdebug for powerful debugging and performance analysis Introduction: In the process of developing PHP applications, debugging and performance analysis are essential links. Xdebug is a powerful debugging tool commonly used by PHP developers. It provides a series of advanced functions, such as breakpoint debugging, variable tracking, performance analysis, etc. This article will introduce how to use Xdebug for powerful debugging and performance analysis, as well as some practical tips and precautions. 1. Install Xdebug and start using Xdebu

How to perform performance analysis of C++ code? How to perform performance analysis of C++ code? Nov 02, 2023 pm 02:36 PM

How to perform performance analysis of C++ code? Performance is an important consideration when developing C++ programs. Optimizing the performance of your code can improve the speed and efficiency of your program. However, to optimize your code, you first need to understand where its performance bottlenecks are. To find the performance bottleneck, you first need to perform code performance analysis. This article will introduce some commonly used C++ code performance analysis tools and techniques to help developers find performance bottlenecks in the code for optimization. Profiling tool using Profiling tool

How to use performance analysis tools to analyze and optimize Java functions? How to use performance analysis tools to analyze and optimize Java functions? Apr 29, 2024 pm 03:15 PM

Java performance analysis tools can be used to analyze and optimize the performance of Java functions. Choose performance analysis tools: JVisualVM, VisualVM, JavaFlightRecorder (JFR), etc. Configure performance analysis tools: set sampling rate, enable events. Execute the function and collect data: Execute the function after enabling the profiling tool. Analyze performance data: identify bottleneck indicators such as CPU usage, memory usage, execution time, hot spots, etc. Optimize functions: Use optimization algorithms, refactor code, use caching and other technologies to improve efficiency.

Analysis and optimization strategies for Java Queue queue performance Analysis and optimization strategies for Java Queue queue performance Jan 09, 2024 pm 05:02 PM

Performance Analysis and Optimization Strategy of JavaQueue Queue Summary: Queue (Queue) is one of the commonly used data structures in Java and is widely used in various scenarios. This article will discuss the performance issues of JavaQueue queues from two aspects: performance analysis and optimization strategies, and give specific code examples. Introduction Queue is a first-in-first-out (FIFO) data structure that can be used to implement producer-consumer mode, thread pool task queue and other scenarios. Java provides a variety of queue implementations, such as Arr

Tools and techniques for code optimization and performance analysis in JavaScript Tools and techniques for code optimization and performance analysis in JavaScript Jun 16, 2023 pm 12:34 PM

With the rapid development of Internet technology, JavaScript, as a widely used front-end language, is receiving more and more attention. However, when processing large amounts of data or complex logic, JavaScript performance will be affected. In order to solve this problem, we need to master some code optimization and performance analysis tools and techniques. This article will introduce you to some commonly used JavaScript code optimization and performance analysis tools and techniques. 1. Code optimization to avoid global variables: global variables will occupy more

Go pprof in simple terms: improve code performance Go pprof in simple terms: improve code performance Apr 07, 2024 pm 05:45 PM

pprof is a Go performance analysis tool provided by Google that can be used to generate performance data during program running. By enabling performance profiling (CPU/memory allocation) and using the gorun command to generate configuration files, developers can use the pprof tool to interactively analyze data, identify time-consuming functions (top command) and generate more detailed visual reports (web command) , thereby discovering optimization points.

See all articles