The front end is the closest battlefield to the user, and the front end performance directly affects the user experience. It can be said that performance optimization is a necessary knowledge point and core skill for beginner and intermediate engineers to advance to senior engineers.
The business value of performance optimization
- For mbify, every 100ms increase in the speed of the homepage load increases the conversion rate by 1.11% and increases the average annual revenue by $380,000;
- Pinterest rebuilt their page for performance, reducing perceived wait time by 40%, resulting in a 15% increase in search engine traffic and signups;
- By reducing the average page load time by 850ms, COOK found that they were able to increase conversions by 7%, reduce bounce rates by 7%, and increase the number of pages per page by 10%;
It can be seen that the impact of front-end performance optimization is directly linked to our revenue, and high-performance websites are better at attracting and retaining users than poor-performing websites.
"50% of users will abandon a website that loads in more than 3 seconds"
If high performance is an asset, poor performance is a liability. Performance optimization is a topic that cannot be avoided after a project has developed for a certain period of time. It is also a thorn in the heart of every engineer. The quality of the product determines the customer's experience. There are many factors in the quality of a product, among which performance is the determining factor.
- When users can get a response within 2 seconds, they will feel that the system responds quickly;
- When the user gets a response within 2-5 seconds, they will feel that the response speed of the system is OK;
- When users get a response within 5-8 seconds, they will feel that the response speed of the system is very slow, but it is acceptable;
- When the user still can't get a response after more than 8 seconds, he will feel that the system is bad, or think that the system has lost response, and choose to leave the Web site, or initiate a second request.
The performance of a website is the basis for retaining users and realizing monetization, and it is also an issue that our front-end engineers pay attention to every day.
Front-end performance optimization for full solution in both directions
There are a lot of performance optimization points. Some friends find it very troublesome to remember. You can remember these two directions:
- Load-time optimization: preloading, caching, network layer, page parsing, static resources,
- Runtime optimization: avoid forced synchronous layout, long list optimization, avoid long js execution time, parallel computing - service worker, composite layered drawing, scroll event performance optimization, passive event listeners, animation
Load-time optimization
From the perspective of user experience, how to make others feel that your website performance is good, even if it is just an illusion, that is, the white screen time and the first screen time:
- The white screen time refers to the time from when the browser responds to the user inputting the URL address to when the browser starts to display the content.
- The time above the fold refers to the time from when the browser responds to the user's input of a network address to when the content on the fold is rendered.
- Factors affecting the white screen time: network, server performance, front-end page structure design.
- Factors affecting the first screen time: white screen time, resource download execution time.
Therefore, we can give priority to loading above-the-fold resources, and load non-fold-fold resources on demand or lazily to speed up the rendering speed of above-the-fold.
We can explore optimization points from this process: hand over DNS domain name resolution -> find the corresponding IP address -> then make a TCP connection -> the browser sends an HTTP request -> the server receives the request -> the server processes the request and returns an HTTP message -> And the browser receives and parses the rendered page to speed up the access speed of the website and improve the performance by shortening the request time.
The optimization points that can improve performance in this process:
- DNS resolution optimization, browser access time to DNS can be shortened
- Use HTTP2
- Reduce the number of HTTP requests
- reduce http request size
- Server-side rendering
- Static resources use CDN
- Resource caching, do not load the same resource repeatedly
Runtime performance optimization
On the other hand, we can optimize from the runtime performance. The runtime performance refers to the performance of the page when it is running, not the performance when the page is loaded. The runtime performance of the page can be analyzed through the Performance panel in the chrome developer tools.
- Reduce redraws and reflows
- Avoid page lag
- Long list optimization
- Scroll event performance optimization
- Using Web Workers
- Optimization points when writing code
Experts in the field of performance take you to play with front-end performance optimization
Donald Knuth famously said, "Premature optimization is the root of all evil". At present, we learn and solve front-end performance optimization problems, often through some online tutorials, or by reading some old tutorial articles. The knowledge learned in this way is not only not systematic, but also does not have a good methodological summary. There is no standard answer to front-end performance optimization. It is not easy to list everything. It has different methods for various resources.
The HeapDump performance community is the first vertical technical community in China that focuses on the performance field . Hundreds of thousands of developers discuss and share performance knowledge here. As the most important part of the performance field—large front-end performance optimization, the HeapDump performance community has already Establish strategic cooperation with the front-end early chat community to empower more front-end developers.
This time I bring you the [Big Front-End Performance Optimization Training Camp ] produced by the HeapDump Performance Community. This course will take you from the perspective of practical application, combined with [Theory + Practice] to talk about the front-end performance optimization issues you are most concerned about!
It lasted for 11 days, 3 experts, 5 live courses, take you to play the big front-end performance optimization for free.
Boot Camp Highlights
High-quality live broadcasts interact face-to-face with lecturers in real time to deepen understanding; also provide relevant homework exercises to consolidate your learning results.
Rich teaching materials are uploaded and updated in real time, and teaching materials such as lecturer courseware, live playback, technical documents, etc. are completely open to you, in case you need to check them at any time.
Questions encountered in this course can be asked at any time in the [Training Camp Exchange Group], the lecturer will answer them patiently and in detail, and even small partners will communicate and interact together to make progress together!
Massive gifts are waiting for you
Sign up to join the group to participate in the lottery, and there are even more generous gifts for classroom participation and interaction! Complete the course for a chance to win a cherry keyboard!
class schedule
11 days, 5 courses, various practical assignments, from entry to proficient, and play with various experts to optimize front-end performance. Joining the group can also learn knowledge and improve technology with other small partners!
Introduction of famous teachers
Registration link
https://www.heapdump.cn/training/detail/4?source=sifou
Scan the code to join now
Scan WeChat, sign up for free, join the group politely
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。