# Performance data

In order to better help developers understand and analyze the performance of Mini Programs, we haveSmall Program AssistantPerformance-related statistics are provided on the Mini Program. At the same time, developers can also perform their own escalation analysis based on business needs.

# 1. Get Performance Data

# 1.1 Small Program AssistantPerformance analysisplate

Developers are advised to useSmall Program AssistantinPerformance analysisPlate, continue to pay attention to the performance of Mini programs.

Performance analysis from Start-up, operational and network performance The three dimensions provide performance data for developers to do fine analysis according to conditions such as platform, model, network environment and access source. Scan the Mini Program code below to experience immediately.

The Mini Program Assistant provides the download time, JS, and related to the Mini Program developer during the Mini Program startup and running process. Injection time and initial rendering time for developers to optimize the reference.

At present, the mini program assistant only includes the WeChat client >= 7.0.3 Version of the official version of Mini Program data.

# 1.2 Via server-side interface

Small Program AssistantProvided data, may also be obtained through the server-side interface getPerformanceData Get.

# 1.3 adopt We Analysis

[We Analysis](https://wedata.weixin.qq .com /mp/Login)-Quality of performance-Performance dataAlso provides some performance data version, is still in continuous improvement.

# 1.4 adopt wx.getPerformance Get inside the Mini Program

Developers can use wx.getPerformance Gets information about the performance of the current Mini Program, including information that cannot be stored in the JS Some time information obtained directly from the code. In addition, developers can also manage in Mini programs according to their own business needs.

Specific indicators are described below:

  • ApplLaunch: Mini Programs start time consuming.
    • The starting point is the time the user clicks on the Mini Program icon, or the time it is pulled up
    • The end is the first page. firstRender End time.
  • Route: Page switching time consuming.
  • FirstRender: The page takes time to render for the first time.
    • The starting point is that the logical layer receives routing events, including the logical layer page and component initialization, VD. Synchronization, the time the rendering layer performs rendering
    • End of page. onReady
    • For details, seePage Switching Performance Documentation
  • firstPaint(FP): The page is drawn for the first time
  • firstContentfulPaint(FCP):
  • largestContentfulPaint(LCP):
  • EvaluateScript: Logic layer JS Code injection (including compilation and execution) is time-consuming.

FP、FCP、LCP A time, not a time period, nothing. duration

After obtaining the data, developers can self-report or useMini Program speed measurementFor velocity analysis.

# 2. Factors Affecting Startup Time

It is strongly recommended to read this section carefully before analyzing the time taken to start a Mini Program to avoid pointless work.

according toSmall Program Start Process There are many factors that affect the startup time of Mini Program, and it is a very complicated process to analyze the startup performance of Mini Program.

For the same Mini Program, the following factors will directly affect the average start-up time of the market:

  • platform: Different platforms (Android, iOS, PC) There are great differences in device performance, operating system, framework implementation, optimization scheme, and startup time.It only makes sense to compare start-up time (including the time taken at each stage) by platform
  • Download ratio: Code package download and update will significantly affect the Mini Program start-up time, in the case of other processes time-consuming stability, the increase in the proportion of downloads will affect the market start-up time.
  • Entry page: The number and size of code packages that need to be downloaded and the amount of code injected varies depending on the subcontract at launch of different pages. The rendering time of different pages also varies.
  • Model distribution: There is a strong correlation between start-up time and equipment performance, and differences in user groups of different Mini programs or use scenarios may lead to differences in the distribution of models, which in turn affects the start-up time of the market.
  • network environment: The network environment mainly affects the time consuming of network requests, such as Mini Program information acquisition, code package download, etc.

In addition, the following conditions can also indirectly affect the start-up time:

  • scene/Access to sources: In different scenarios, the pages visited by users are different, and the proportion of new users is also different, which will have a certain impact on the start-up time. In addition, the purpose of the user's visit and their own willingness to wait are also different, which will also affect the open rate.
  • Proportion of first-time visitors: When users access the Mini Program for the first time, they need to complete the process of preparing the Mini Program information and downloading the code package, and the code cache also needs to be regenerated, and the start-up time will be higher than that of non-first access.
  • Mini Program version update: When the Mini Program version is updated, the user needs to update the Mini Program information and code package, the code cache also needs to be regenerated, and the start-up time will rise.

# 3. Startup data FAQ

(1) whyTotal startup timeand Download time、js Injection time、Initial rendering timeIs the sum very different?

Although the total start-up time includes downloading, js Injection and the initial rendering phase, but the performance data in the Total startup time and Download time + js Injection time + Initial rendering timeThere is no necessary correlation betweenFor several reasons:

  • The granularity of these indicators is inconsistent: the total startup time is based on a cold startup, the download time is based on the code package, and the js Injection time is based on file granularity, and initial rendering time is based on page granularity, not one-to-one.
  • Download, js Injection and initial rendering do not only occur during the startup phase.
    • Downloading may also occur in the context of page switching and pre-downloading. It is not necessary to download a code package during startup, nor is it necessary to download only one code package.
    • js Injection may also occur during page switching and Mini Programs running. One or more files may be injected during startup and affected by dimensions such as caching.
    • The first rendering may also occur during page switching and is also affected by dimensions such as caching
  • These time-consuming itself is the average, involving different dimensions, there is no corresponding relationship, and the sum is meaningless.
  • Download time consuming, js Injection time, initial rendering time is only a reference for developers to optimize the time of each stage, and can not be used to calculate the relationship with the total start-up time.
  • During the start-up process, in addition to these three parts of the time, under certain conditions there is also a Mini Program related information and running environment preparation time. This part of time consuming is also related to Total startup time - Download time - js Injection time - Initial rendering timeNot necessarily.

(2) Why does the startup time go down at each stage, but the total time goes up?

**The decrease in the average of the time spent in each stage does not necessarily reflect the decrease of the total time spent.**For example

  • After the release of the new version of the Mini Program, even if the time spent at each stage is reduced, the increase in the proportion of downloads may lead to an increase in the total time spent.
  • A sudden spike in downloads from a small subcontractor may have reduced the average download time, but had no noticeable impact on startup.

(3) Why is it that every time a Mini Program version is released, it leads to a rise in startup time for a period of time?

After the new version of the Mini Program is released, in order to ensure that users switch to the latest version as soon as possible, users need to wait for the Mini Program to be updated synchronously when they start the Mini Program (for specific policies, please refer toMini Program update mechanism)。

In addition to the need to re-download the code package, the version update will also cause the inclusion of Mini Program information cache, Code Caching, initial rendering caching, and other caches are updated, which will also affect the time taken to start the Mini Program for the first time after the update. Generally, startup time returns to a stable level within a few days of the release.