Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

WeChat program API performance, get relevant information


May 19, 2021 WeChat Mini Program Development Document


Table of contents


wx.getPerformance()

The base library 2.11.0 starts to support, and the lower version needs to be compatible.

Get information about the performance of the current gadget.

Access to the following types of performance metrics is currently supported:

Category Name (entryType) Index
Routing navigation route, appLaunch
Rendering render firstRender
Script script evaluateScript
  • Route: Routing performance
  • AppLaunch: Small programs take time to start
  • FirstRender: The first rendering of the page took time
  • EvaluateScript: Injecting scripts takes time

The sample code

const performance = wx.getPerformance()
const observer = performance.createObserver((entryList) => {
  console.log(entryList.getEntries())
})
observer.observe({ entryTypes: ['render', 'script'] })