Performance optimization of WeChat applet

If the front end only stops at coding and implementing business functions, the speed of progress may be a little slow, but if you have experienced the performance optimization of the page and achieved results, it will be different, because you have studied the mechanism behind it. to optimize performance.

 

The same is true for WeChat mini-programs, not only to achieve business functions, but also to consider the speed of page opening, and the opening speed of Android and ios is completely different, ios will be much faster, and some speed on Android is unacceptable, improving user Experience is our purpose, and we should have this awareness before development, and we will naturally pay attention to it later in coding.

One of our previous small programs was optimized for performance before going online, but because we didn’t pay attention to these things at the beginning, we found that the speed was really stuck and unacceptable after testing. Later, we went through a major overhaul to improve the performance.

 

In fact, these optimization methods are all used by us for web sites, and they are also applicable to small programs. As long as the ideas are correct, the specific implementation is easy to say.

 

Let's talk about the specific optimization method:

1. The data of setdata should not be too large or too frequent. The merge operation can be performed multiple times.

2. Do not write the data that is not used in the view into the data, so as to avoid the transmission of garbage data.

3. The interface returns data for secondary processing. Do not directly stuff it into data. Direct use will cause a lot of redundant data.

4. The page is deferred rendering. If the page is very long, the data can be lazily loaded. The first screen data is loaded, and the other is deferred.

5. Image lazy loading

 

There may be other methods, but the above are the more effective methods I have used. If there are better ones, you can communicate with them.

 

Only after optimization can you really write a small program, because you have a deep understanding of the mechanism behind it.

 

Well, that's it for today, if you have any questions, you can add v to come to me. See you next time.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325722635&siteId=291194637