Home >Web Front-end >JS Tutorial >What does lazy loading mean?

What does lazy loading mean?

Guanhui
GuanhuiOriginal
2020-06-24 16:22:255269browse

Lazy loading is a unique and powerful data acquisition method. It can automatically obtain more data when the user scrolls the page, and the newly obtained data will not affect the display of the original data. At the same time Minimize server-side resource consumption.

What does lazy loading mean?

#In Web applications, the bottleneck of the system often lies in the system's response speed. If the system response speed is too slow, users will complain and the value of the system will be greatly reduced. Therefore, it is very important to improve the system response speed.

The most Web applications do is interact with the backend database, and querying the database is a very time-consuming process. When there are too many records in the database, query optimization becomes even more important. In order to solve this problem, someone proposed the concept of cache. Caching is to store frequently used data in memory for quick access. After the user performs a query operation, the queried records will be placed in the cache. When the user queries again, the system will first read it from the cache. If it is not in the cache, then query the database. Caching technology improves system performance to a certain extent, but when the amount of data is too large, caching is not suitable. Because the memory capacity is limited, placing too much data in the memory will affect computer performance. Another technology, lazy loading, can solve this problem.

Application Case

Consider this example: Haier Electric is a very large organization with more than 10,000 organizational units under it. Due to the complexity of organizational units, there are also superior-subordinate relationships between organizational units. The question now is: if a user wants to join an organizational unit of Haier Electric, how should he choose this organizational unit?

A solution that can easily be thought of is to query the database and put all the organizational units of Haier Electric into a drop-down list for the user to select. This indeed solved the problem, but the test found that the browser suspended animation when displaying the organizational unit data. It seems that the performance of this method is too poor and may not be adopted.

Another solution is to use lazy loading technology. Since there is a superior-subordinate relationship between organizational units, the arrangement of organizational units can be treated as a tree. When displaying data, only the parent node is displayed. When the parent node is clicked, the child nodes under the parent node are displayed.

To select an organizational unit, the user only needs to click on the parent node of the organizational unit to find the organizational unit.

It can be seen that lazy loading saves system response time and improves system performance, which is very valuable.

Recommended tutorial: "JS Tutorial"

The above is the detailed content of What does lazy loading mean?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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