Applet performance optimization

Use Audits (debug tool)

Experience Rating:

  1. Avoid picture is too large to effectively display a smaller area , waste flow and drop loading speed;
  2. Network image resources should enable HTTP cache control , reducing the number of requests;
  3. Avoid request takes too , should be optimized better server processing time, packet size is reduced back, bottom load may be used;
  4. Avoid too many pictures request to initiate a short time , otherwise it will trigger limit browser loaded in parallel, can lead to slow loading images, users have been waiting for treatment. It should be a reasonable amount of control, consider using Sprite map technology or picture outside the screen using lazy loading;
  5. Avoid too many requests to initiate a short time , otherwise it will trigger small programs limit the number of concurrent requests, while too many requests may also lead to problems such as slow loading, should be the reasonable control of the number of requests, or even a request of the merger;
  6. Avoid setData data is too large , can not exceed more than 1M, due to the small program running on a logical thread and rendering thread, setData call will render layer data transmitted from the logic layer, data is too large to increase communication time;
  7. Avoid calling setData too often, calling setData interface logic involves inter-thread rendering layer by layer and, too often may lead to communication processing queue blocking, rendering the interface is not timely and lead to Caton, should avoid useless frequent calls;
  8. Avoid unbound variables passed in WXML setData , can be defined on the outside, reducing performance overhead due setData;
  9. Avoid time-consuming execution of the script is too long , took too long to make the user feel Caton, a bad experience, when this situation occurs, it is necessary to identify and optimize the logic of the script;
  10. Necessary to make network requests to avoid unnecessary cache request , the request for the same cache, reducing the user waiting time;
  11. All resource requests are recommended to use HTTPS , the security can not easily be tampered with;
  12. Avoid the use of obsolete interface ;
  13. Timer recovery following the page, when the page is destroyed or hidden, should the recovery timer;
  14. Avoid excessive number WXML nodes ,
    1. Less than 1000 WXML nodes;
    2. Layer 30 is less than the depth of the tree node;
    3. Child nodes is not greater than 60.
  15. The first screen to avoid too long a case can be subcontracted processing;
  16. Reasonable clickable elements provided region size of the response , as a button, not too small;
  17. Avoid using css ': active' pseudo-class to implement click state ,: active bad effect, when rolling or sliding, no click state disappears; hover-class should be used alternatively;
  18. Should let the picture aspect ratio of the original chart, it may cause picture distortion, unsightly, and even lead to user identification difficult. Image mode attribute may be set as the case assembly to maintain the original aspect ratio;
  19. Scroll inertial scrolling area can be opened to enhance the experience,
    1. In the default Android with inertial scrolling;
    2. The need for additional set `-webkit-overflow-scrolling in iOS: touch` style;

Run experience score (start), avoid excessive number WXML node and then all the pages of the operating functions, after operation (STOP), Audits will print out the performance, experience and best practice score and give optimization recommendations .

According to Audits give advice and optimization positioning to optimize.

 

 

 

 

 

 

 

 

 

 

Guess you like

Origin www.cnblogs.com/baixinL/p/12003119.html