# Benchmarks

The diagnostic tool measures five aspects of startup performance, skipping performance, best practices, operating experience, and network performance.

Some startup performance metrics have the same meaning as skippage performance metrics, and the performance report distinguishes the front page from other pages to make it easier to detect problems in the startup process.

# Explanations of nouns

  • Long tasks: Perform functions that take more than 50ms.
  • Injection on demand: inject only the custom components and page code that are needed to access the page at the moment.
  • Time injection: When the On-Demand Injection feature is turned on, time injection can specify that a portion of a custom component is not injected when Weixin Mini Program starts, but only when it is actually rendered.

# List of indicators

classification index No standards were adopted
Startup performance Long Tasks in the App Life Cycle Life-periodic function time > 50ms
Avoid non-essential global plug-ins There are plug-ins introduced globally
Use On-Demand Injection No On-Demand Injection is turned on
Home redirect Redirect to another page immediately after the home page is launched
Inline base64 Pictures Home WXSS inline base64 images > 10kB
Jump page performance Synchronization API blocking Multiple calls to the synchronization API before the page is rendered
Page opens request Page request only time > 200 ms
Components declared but not used Components not used during page access
Long tasks in the page life cycle Page periodic function takes > 50ms
Show the top search box first The top search box is not displayed preferentially for new pages
Go to the Details page to reuse the image Click on the image to go to the details page Unused image caused a white screen
Best practices Cachestorageresults Home repeatedly gets local cache for the same key value
Maintain reasonable control over local cache size Local cache usage exceeds 50%
CachesystemInforesults GetSystemInfoSynchronous & asynchronous interface calls more than 3 times
Avoid unhandledJavaScriptexceptions There is an unhandledJavaScriptexception
Script execution takes too long Page method time > 50 ms
Avoid using emptyonPageScrollfunctions. The functiononPageScrolldoes not exist.
CachegetLocationresults Repeat calls within 30sgetLocation
Avoid time consuming logic inscrollevent scrollEvent processing time > 10 ms or total time > 150 ms
Adjust the picture size appropriately There are pictures that are too large and the effective display area is small
Send pictures in modern format Usewebpinstead ofJPEGandPNGImages
Encode Pictures Efficiently Correctly compress the picture
Producing animated content using video format LargeGIFmore efficient conversion to video
Avoid built-in leaks fromwx.ontype interfaces wx.onType Monitor
Avoidobservetype interface leakage Page destruction is not stoppedobservetype monitor
Operational Experience Reuse nodes when rotating components switch A node that is not reused when rotating components switch causes flashing whiteness
Set the clickable element size reasonably Clickable element < 20px
Interactive events are quick to respond to Presence interaction event processing time > 50 ms or total time > 150 ms
CustomtabbarNo flicker when switching CustomtabbarFlicker when switching
Network performance UsingHTTP / 2 HTTP / 2
Avoid network request failure There was a network request failure
Avoid network status code anomalies There is a network status code exception
Reduce network queues Network queues > 50 or average queuing time > 1500 ms