当前位置:网站首页>Page performance: how to optimize pages systematically?
Page performance: how to optimize pages systematically?
2022-07-25 03:07:00 【Gary_ Leong】
Usually a page has three stages : Loading phase 、 Interaction phase and shutdown phase .
Loading phase

The core factors that affect the first rendering of a page :
Number of key resourcesThe more critical resources , The longer the first page will load . For example, the number of key resources in the figure above is 3 individual ,1 individual HTML file 、1 individual JavaScript and 1 individual CSS file .Key resource sizeUsually , The smaller the content of all the key resources , The shorter the download time of its entire resource , The less time it takes to block rendering .How many are required to request critical resources RTT(Round Trip Time)RTT That's the round trip delay here . It is an important performance index in the network , Indicates that data is sent from the sender , Receive confirmation from the receiving end to the sender , Total time delay experienced .
The general optimization principle is Reduce the number of critical resources , Reduce the size of critical resources , Reduce critical resources RTT frequency .
Interaction phase

- Reduce JavaScript Script execution time
- Avoid forcing layout synchronization
Synchronize layout :JavaScript Forces calculation styles and layout operations to be advanced to the current task . - Avoid layout jitters
Layout jitter : Over a period of JavaScript In the code , Repeat the layout operation . - Reasonable use CSS Composite animation
Synthetic animation is directly inComposite threadPerformed on , This and the layout that is executed on the main thread 、 Drawing and other operations are different , If the main thread is JavaScript Or some layout tasks occupy ,CSS The animation can still be executed . So make the best use of CSS Composite animation , If we can let CSS Working with animation , Just give it to CSS To operate . - Avoid frequent garbage collection when garbage collection operations occur , Will occupy the main thread , Thus affecting the execution of other tasks , In serious cases, it will also cause users to lose frames 、 The feeling of not flowing .
summary
In the loading phase , The core optimization principle is : The key to optimizing the loading speed of resources , Reduce the number of key resources , Reduce critical resources RTT frequency .
In the interaction phase , The core optimization principle is : Minimize the generation time of one frame . You can reduce words JavaScript Execution time of 、 Avoid forcing layout synchronization 、 Avoid layout jitters 、 Use as far as possible CSS Composite animation 、 Avoid frequent garbage collection to reduce the generation time of a frame .
边栏推荐
- Resolve the error: org.apache.ibatis.binding.bindingexception
- Eslint error
- JS construct binary tree
- List.stream common operations
- NVM installation and use
- Do you know about real-time 3D rendering? Real time rendering software and application scenarios are coming
- New key points of ES6
- kettle_ Configure database connection_ report errors
- Ffmpeg 4.3 add custom demuxer
- If there is a segment in the encryption field, are you "bronze" or "King"?
猜你喜欢

JS written test question -- deep copy of object

JS foundation -- math

Beginners must see the markdown User Guide

FLASH read / write problem of stm32cubemx

Preliminary foundation JVM

Experiment 4 CTF practice

Study notes of filebeat

Learning Record V

MySQL common function summary, very practical, often encountered in interviews

The latest interview questions and analysis of software testing in 2022
随机推荐
Learning record 10
Learning record Xi
Selenium framework operation steelth.min.js file hides browser fingerprint features
Learning record 12
Stm32cubemx quadrature encoder
C: wechat chat software instance (wpf+websocket+webapi+entityframework)
Using one stack to sort another stack
[jailhouse article] scheduling policies and system software architectures for mixed criticality
Arduino + si5351 square wave generator
Dynamic programming -- Digital DP
Use of stm32cubemonitor part I - data plotting and instrument display
Inheritance (prototype)
Riotboard development board series notes (V) -- porting u-boot
Error: tomee required to support ear/ejb deployment
New key points of ES6
Read and upgrade st-link chip information and SWD burning media through STM32 stlink utility tool
Domain driven model (DDD)
Resolved (the latest version of selenium reported an error) attributeerror: module 'selenium webdriver‘ has no attribute ‘PhantomJS‘
Hashcode details
Uni app configuration